[PyQt] custom sections in a QDateTimeEdit

Hans-Peter Jansen hpj at urpla.net
Thu Jun 11 13:21:41 BST 2009


Am Donnerstag, 11. Juni 2009 schrieb Victor Noagbodji:
> hello,
>
> is it possible to have custom sections in a QDateTimeEdit?
>
> we are trying to build a custom date edit that will allow users to
> select the beginning of quarters in a year.
>
> for example
>
>
> -----------------------
>
> | Quarter 2    | 2009 |
>
> -----------------------
>
> will store the date 1st of April 2009
>
> i have looked at sections of the QDateTimeEdit and it seems like they
> are hard coded and we cannot change them. any suggestion on how to do
> it?

I would create a custom composite widget consisting of two combo boxes while 
ignoring QDateTimeEdit all together. QDateTimeEdit has a few caveats, which 
limit its usefulness in many cases. Yours is way to special to make it work 
the way you want. If you need to handle invalid dates (e.g. NULL dates in 
database applications), you've lost anyway.

Cheers,
Pete


More information about the PyQt mailing list