QDateEntry: setting current date as mimimum
Florian Bruhin
me at the-compiler.org
Wed May 5 18:59:15 BST 2021
Hey Rich,
Your issue is not specific to QDateEntry, it's essentially just a
misplaced parenthesis:
On Wed, May 05, 2021 at 10:46:30AM -0700, Rich Shepard wrote:
> cont_date = qtw.QDateEntry(self,
> date = qtc.QDate.currentDate(),
> calendarPopup = True,
> displayFormat = 'yyyy-MM-dd HH:mm',
> cont_date.setMinimumDate(QDate(self.now_date)),
> cont_date.setSizePolicy(qtw.QSizePolicy.Fixed, qtw.QSizePolicy.Preferred))
Here you're passing "cont_date.setMinimumDate(QDate(self.now_date))" and
"cont_date.setSizePolicy(qtw.QSizePolicy.Fixed, qtw.QSizePolicy.Preferred)"
as __init__ arguments to the qtw.QDateEntry(...) class.
Instead, either call those after constructing the object:
cont_date = qtw.QDateEntry(
self,
date = qtc.QDate.currentDate(),
calendarPopup = True,
displayFormat = 'yyyy-MM-dd HH:mm',
)
cont_date.setMinimumDate(QDate(self.now_date))
cont_date.setSizePolicy(qtw.QSizePolicy.Fixed, qtw.QSizePolicy.Preferred)
or perhaps pass them as keyword arguments like you do for the others:
cont_date = qtw.QDateEntry(
self,
date = qtc.QDate.currentDate(),
calendarPopup = True,
displayFormat = 'yyyy-MM-dd HH:mm',
minimumDate = QDate(self.now_date),
sizePolicy = (qtw.QSizePolicy.Fixed, qtw.QSizePolicy.Preferred),
)
(untested, no idea if that works, especially for the sizePolicy)
Florian
--
me at the-compiler.org | https://www.qutebrowser.org
https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210505/ae87fa16/attachment.sig>
More information about the PyQt
mailing list