[PyQt] How to clear QDateTime
mnations.lists at gmail.com
Mon Feb 2 22:00:55 GMT 2009
Thanks! ...it does work and functions like I need it to.
On Sun, Feb 1, 2009 at 3:24 PM, David Boddie <david at boddie.org.uk> wrote:
> On Sun Feb 1 20:53:45 GMT 2009, David Douard wrote:
> > Le Saturday 31 January 2009 19:15:23 Marc Nations, vous avez écrit :
> > > I can't seem to clear out the QDateTime field in cases where I don't
> > > the date displayed. Using clear() seems to wipe out the first entry (in
> > > this case the hour). I tried hitting multiple clears thinking that it
> > > just work down the list, but that didn't work. Is there a way to blank
> > > out the field completely? I know it can be disbled, but I'd like to
> > > it be blank until the user goes and selects the pop-up calendar.
> > This is a gap in Qt, and it won't happen before a while. See
> One way to do this is to access the QLineEdit child widget of the
> QDateTimeEdit and clear that instead, like this:
> dateTimeEdit = QDateTimeEdit()
> lineEdit = dateTimeEdit.findChild(QLineEdit)
> Note that this puts the QDateTimeEdit into a state where validation is not
> used, so you need to make sure that it's enabled again before you let the
> user enter text. Perhaps disable the QDateTimeEdit as well to prevent that
> from happening and set the current section when you enable it again.
> As with all these hacks to get at the widgets behind the scenes, it's not
> guaranteed to work, either now or in the future, but it may prove to be a
> useful workaround if it happens to work for you.
> PyQt mailing list PyQt at riverbankcomputing.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt