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

QComboBox - minimumSizeHint issue

    XMLWordPrintable

    Details

    • Platform/s:
      All

      Description

      QComboBox do not reset cached var "minimumSizeHint" after the font has changed.

       

      // Qt 5.15, QComboBox implementation
      ...
      /*! \reimp */
      void QComboBox::changeEvent(QEvent *e)
      {
          Q_D(QComboBox);
          switch (e->type()) {
          case QEvent::StyleChange:
              d->updateDelegate();
      #ifdef Q_OS_MAC
          case QEvent::MacSizeChange:
      #endif
              d->sizeHint = QSize(); // invalidate size hint
              d->minimumSizeHint = QSize();
              ...
              break;
          case QEvent::FontChange: {
              d->sizeHint = QSize(); // invalidate size hint
              /* d->minimumSizeHint = QSize(); it is necessary too !!! */
              d->viewContainer()->setFont(font());
              d->viewContainer()->itemView()->doItemsLayout();
              if (d->lineEdit)
                  d->updateLineEditGeometry();
              break;
          }
          default:
              break;
          }
          QWidget::changeEvent(e);
      }
      ...

      QAbstractSpinBox for example:

       

      // Qt 5.15, QAbstractSpinBox implementation
      ...
      bool QAbstractSpinBox::event(QEvent *event)
      {
          Q_D(QAbstractSpinBox);
          switch (event->type()) {
          case QEvent::FontChange:
          case QEvent::StyleChange:
              d->cachedSizeHint = d->cachedMinimumSizeHint = QSize();
              break;
      
          ...
          }
          return QWidget::event(event);
      }
      

       

       

        Attachments

        1. bug_combo.zip
          3 kB
        2. combo_bug.gif
          combo_bug.gif
          408 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            amuralev Artem Muralev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes