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

The placeHolder is no longer visible after the change applied when fixing QTBUG-86580

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.2
    • Quick: Widget
    • None
    • All

    Description

      To solve the problem of QTBUG-86580, the currentText was changed but the target of the placeHolderText was also affected as it is no longer visible. One possible solution is to change to:

      void QComboBox::initStyleOption(QStyleOptionComboBox *option) const
      {
          if (!option)
              return;
      
          Q_D(const QComboBox);
          option->initFrom(this);
          option->editable = isEditable();
          option->frame = d->frame;
          if (hasFocus() && !option->editable)
              option->state |= QStyle::State_Selected;
          option->subControls = QStyle::SC_All;
          if (d->arrowState == QStyle::State_Sunken) {
              option->activeSubControls = QStyle::SC_ComboBoxArrow;
              option->state |= d->arrowState;
          } else {
              option->activeSubControls = d->hoverControl;
          }
          if (d->currentIndex.isValid()){
              option->currentText = currentText();
              option->currentIcon = d->itemIcon(d->currentIndex);
          }
          else{
              if(!d->placeholderText.isEmpty()){
                  option->currentText = d->placeholderText;
              }
          }
          option->iconSize = iconSize();
          if (d->container && d->container->isVisible())
              option->state |= QStyle::State_On;
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              tvete Paul Olav Tvete
              eyllanesc Edwin Christian Yllanes Cucho
              Votes:
              3 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes