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

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: Quick: Widget
    • Labels:
      None
    • Platform/s:
      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

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

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes