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

With the style Oxygen, QDateTimeEdit in calendarPopupMode still have the behavior of a spin box

    XMLWordPrintable

Details

    Description

      A QDateTimeEdit with calendarPopup set to true have a strange behavior with the style oxygen.

      To reproduce the problem, start the following code and click in the right margin.

      #include <QtGui>

      int main(int argc, char **argv){
      QApplication app(argc, argv);
      QDateEdit dateEdit;
      dateEdit.setCalendarPopup(true);
      dateEdit.show();
      return app.exec();
      }

      With the style Oxygen, the button of the QDateTimeEdit does not cover all the surface where the spin box controls usually are. The "if" fails in following code and the spin box are invoqued.

      d->updateHoverControl(event->pos());
      if (d->hoverControl == QStyle::SC_ComboBoxArrow)

      { [...]; }

      else

      { QAbstractSpinBox::mousePressEvent(event); }

      Here is a patch to avoid all behavior of the QAbstractSpinBox in calendarPopup mode:
      diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
      index ef01d7c..b9c2bca 100644
      — a/src/gui/widgets/qdatetimeedit.cpp
      +++ b/src/gui/widgets/qdatetimeedit.cpp
      @@ -1499,8 +1499,6 @@ void QDateTimeEdit::mousePressEvent(QMouseEvent *event)
      d->positionCalendarPopup();
      //Show the calendar
      d->monthCalendar->show();

      • } else { - QAbstractSpinBox::mousePressEvent(event); }

        }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bachewii Jens
            poulain Benjamin Poulain (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes