Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-7842

QDateTimeEdit treats Shift+KeyPad_1 different from KeyPad_1 with numlock pressed

    XMLWordPrintable

Details

    • a767da6f2d0fbee707f5c2fe896fa501b3da6b07

    Description

      Steps to reproduce:

      • Focus the month of the date and remove the numbers
      • With numlock disabled enter a new month, say 11 by holding shift and using the numeric keypad
      • Notice that after entering 11 the "year"-text isn't selected, as it would be if the numbers had been entered using the numbers above QWERTY or using the numeric keypad with numlock enabled.

      The following patch fixes this issue, but likely introduces others as the modifiers check is expectedly there for a reason:

      diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
      index 4d165c0..1c20188 100644
      — a/src/gui/widgets/qdatetimeedit.cpp
      +++ b/src/gui/widgets/qdatetimeedit.cpp
      @@ -1179,7 +1179,7 @@ void QDateTimeEdit::keyPressEvent(QKeyEvent *event)
      return; }
      }
      QAbstractSpinBox::keyPressEvent(event);

      • if (select && !(event->modifiers() & Qt::ShiftModifier) && !d->edit->hasSelectedText()) {
        + if (select /&& !(event->modifiers() & Qt::ShiftModifier)/ && !d->edit->hasSelectedText()) {
        if (inserted && d->sectionAt(d->edit->cursorPosition()) == QDateTimeParser::NoSectionIndex) {
        QString str = d->displayText();
        int pos = d->edit->cursorPosition();

      Attachments

        1. qdatetimeedit.cpp.diff
          0.7 kB
          Thomas Sondergaard
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            ts Thomas Sondergaard
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes