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

Editable QComboBox contents are vertically off center on mac

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.2.1
    • None
    • Mac OSX 10.9
    • macOS

    Description

      The contents of a QComboBox are a pixel to high on the Mac

      Repro

      1. Create a QtCreator sample app and throw a QComboBox inside.
      2. Set the QComboBox to be editable
      3. Run the app, type in some text and select it.
      4. Notice the rectangle is about a pixel too high (more on Mac High DPI)

      I have attached a screenshot of an app run on a Mac with Retina display.

      The work around is to add the following code to the QStyle::subControlRect

      case CC_ComboBox:
      {
      if (const QStyleOptionComboBox* combo = qstyleoption_cast<const QStyleOptionComboBox*>(option))
      {
      if (subControl == SC_ComboBoxEditField)

      { result.moveTop(result.top() + 1); result.moveBottom(result.bottom() + 1); return result; }

      else
      return result;
      }
      }
      break;

      Attachments

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

        Activity

          People

            peppe Giuseppe D'Angelo
            nteeuwentableau Nicolas Teeuwen
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes