Results 1 to 15 of 15

Thread: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

  1. #1
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Hi
    Does someone use current QDateTimeEdit in Qt4 ?

    When one finishes editing one section, having typed the two digits most of the time,
    a press of a non-digit key is required, easiest being "tab" (just one key press,
    under the control of the left hand while the right hand can hold with numeric keypad).
    If instead, a digit is entered, it is lost, non echoed because validate will have discarded
    it. Not very friendly. And if one gets used to hitting "tab" between sections,
    edtion of a date/time in a table will give surprise...

    Furthermore, when one clicks into this widget to give it the focus,
    no section is selected. So again, typing digits is vain, you have to select the section,
    with whichever trick (a vertical movement is the quickest way).

    A friend of mine that has used the QDateEdit in Qt3 says the component was perfect.
    So what has happened and how can we get around this unkindness efficiently ?

    I wrote a hack (bad, a hack is bad by essence ) around validate but that does not satisfy me intellectually and I still
    can not get around a special case (trying to enter a '1' in third place of month that
    I translate into a '1' in first place of year, will trigger a "hard" validation
    --because of the change of section-- that refuses the '1' in first position unless the next three digits are >= 752)

    Should I file a bug ?

    Thanks in advance. Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Could you post a minimal compilable example which reproduces the problem? Which Qt release do you use? I use 4.2.0 and QDateTimeEdit seems to work fine.

  3. #3
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Hi Wysota.
    I am using Qt4.2.2.
    With next code,

    First case : the first section (days) is selected. Type "11". Days are changed to "11". Full OK. Go on typing "11" (without any other typing in between). It won't change month section to "11".

    Second case : just click in the month (middle) section and type '2'. The '2' won't show.


    #include <QtGui/QApplication>
    #include <QtGui/QDateTimeEdit>
    #include <QtGui/QWidget>
    #include <QtGui/QVBoxLayout>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    QWidget lPanel;
    QVBoxLayout *lVBox = new QVBoxLayout();
    lPanel.setLayout(lVBox);

    QDateEdit *lEdit2 = new QDateEdit();
    // set format as it is given by french(at least) locale
    Edit2->setDisplayFormat("dd/MM/yyyy");
    lVBox->addWidget(lEdit2);

    lPanel.show();

    a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));

    return a.exec();
    }


    Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Quote Originally Posted by lauranger View Post
    First case : the first section (days) is selected. Type "11". Days are changed to "11". Full OK. Go on typing "11" (without any other typing in between). It won't change month section to "11".
    Well... it works for me.

    Second case : just click in the month (middle) section and type '2'. The '2' won't show.
    This works as well...

    I checked with both 4.2.0 and 4.2.2

  5. #5
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    ?? What could do the difference between my case and yours in a so small piece of code ?
    Are sections always selected ? Can you edit the whole date, typing just digits and nothing else ?
    Here clicking in a section, makes the selection disappear. So starting to type digits does not override what is displayed, but as digits are already there, none can be added.

    I double-checked with process explorer 4.2.2 dlls are the one loaded with my test program.

  6. #6
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    May be it could be that I (with a french keyboard) have to use either shit or numlock to produce a digit ?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Quote Originally Posted by lauranger View Post
    ?? What could do the difference between my case and yours in a so small piece of code ?
    I didn't use your code. I opened Designer, placed QDateTimeEdit on a form, changed its properties so that they reflected your code and previed the widget.

    Are sections always selected ?
    No. Only when you click on the section for the first time.
    Can you edit the whole date, typing just digits and nothing else ?
    Yes.
    Here clicking in a section, makes the selection disappear.
    Only if the focus was already in the widget. If the widget gains focus by the click, a section will be selected. I think this is a sane behaviour, but I'm sure you can override it if you wish.
    So starting to type digits does not override what is displayed, but as digits are already there, none can be added.
    I think this is a good thing. Otherwise you'd delete what you already typed.

    I double-checked with process explorer 4.2.2 dlls are the one loaded with my test program.
    I guess the behaviour is correct and it's just that you want something slightly different. But it shouldn't be too hard to make it work the way you want, I think all you need to do is to properly respond to a mousePressEvent.

  8. #8
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Placed 2 QDateEdit in a widget in the designer and entered Preview,
    *first section of first QDateEdit is selected. Click on first section of second QDateEdit,
    this first section is not selected while focus is gained. You said it should select as focus is gained. Here selection does not occur in a focus gain from mouse click.
    *if I type "1112" starting in a selected first section, this first section is turned into "11" but the second section is not turned to "12". Too bad it does not. This would be handy.
    Do we notice the same thing ?

    Quote Originally Posted by wysota View Post
    Only if the focus was already in the widget. If the widget gains focus by the click, a section will be selected. I think this is a sane behaviour, but I'm sure you can override it if you wish.

  9. #9
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Quote Originally Posted by lauranger View Post
    May be it could be that I (with a french keyboard) have to use either shit or numlock to produce a digit ?
    I was right. I switched my keyboard layout to US-english and then when a section is finished edited it selects the next section
    The problem is that my users are french, mostly

    But for the selection at focus gain, still don't know how to get it working.

  10. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Quote Originally Posted by lauranger View Post
    *first section of first QDateEdit is selected. Click on first section of second QDateEdit,
    this first section is not selected while focus is gained.
    True.
    You said it should select as focus is gained. Here selection does not occur in a focus gain from mouse click.
    I tested with a single QDateTimeEdit.

    *if I type "1112" starting in a selected first section, this first section is turned into "11" but the second section is not turned to "12". Too bad it does not. This would be handy.
    Do we notice the same thing ?
    Hmm... well... this one works for me quite nicely - if I finish editing one section the focus automatically jumps to the next section. It is true that it doesn't work that way if you enter "2" instead of "02" in the month section, but I guess this is normal as well, the widget blocks an invalid input. You just need to press Tab to jump into the next section. There is somthing else that I'd consider nice though. If I double click on a section, I'd like that section to be selected. Current behaviour is that the whole date gets selected.

    But as I said - you can easily correct that behaviour yourself.

  11. #11
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    So as my latest post says there are two bugs that I should file.
    Thanks Wysota for the time you give us all.

  12. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    I didn't say they were bugs But you might file suggestions how to improve the widget. A bug is something which causes an object to behave not the way the designer wanted it to.

  13. The following user says thank you to wysota for this useful post:

    lauranger (11th December 2006)

  14. #13
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    The fact that the widget behaves differently with a french keyboard layout from how it behaves with an english keyboard layout indicates a bug, clearly.
    Have a nice evening

  15. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Did you check with an english keyboard layout? Maybe we simply didn't understand each other? Qt doesn't reference a keyboard layout anywhere, so I assure you it's not the matter of a keyboard layout. The keyboard driver works on a lower layer than Qt.

  16. #15
    Join Date
    May 2006
    Posts
    55
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: [QDateTimeEdit] Why autoadvance has gone away between Qt3 and Qt4 ?

    Hi Wysota,

    Quote Originally Posted by lauranger View Post
    I was right. I switched my keyboard layout to US-english and then when a section is finished edited it selects the next section
    The problem is that my users are french, mostly

    But for the selection at focus gain, still don't know how to get it working.
    Here I indicated, I tried with the en-US keyboard layout.
    This was because reading the code in qdatetimeedit.cpp, I noticed the things about modifiers.
    And following the process with the debugger I got disturb with the fact that I could not enter a digit without either
    num-lock (that triggers "bad" the line above QAbstractSpinBox::keyPressEvent, in the default of the case)
    or shift (that triggers "bad" the line after QAbstractSpinBox::keyPressEvent).
    Last case was a pain-for-idiot with the debugger because pressing the shift key would hit the breakpoint
    before the interesting point (the typing of the key that holds the digit, at shifted place.
    For example the unshifted '1' is '&' on french keyboard)

    Have a nice day.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.