Weird QComboBox navigation arrows



  • Hi, I am using Qt 5.2.0 on a Mac.

    Sometimes when I click on a QComboBox it shows only a single item, with a thick frame including scroll arrows in the centre top and bottom. If you click on the scroll arrows you can navigate to the other options but this looks very strange on a Mac (I have never seen it in other software). When I say scroll arrows I don't mean QComboBox::drop-down.

    I guess that this feature is meant for very large QComboBoxes that wouldn't fit on the screen, but this happens even when there are only 2 or 3 options. I want to disable this feature because it hides the other options.

    Thanks in advance for any suggestions.



  • Here are some images of a QComboBox with 3 items:

    http://imgur.com/lP0AeRL

    There are 2 images at this URL. You can see the normal state; then if I click on the widget I get the arrows.

    Edit: the second image showing the unclicked widget is here http://imgur.com/7fFYwO0


  • Lifetime Qt Champion

    Hi,

    Can you provide a minimal code example that shows the behavior ?



  • I'm not using this widget in any special way, it's just a regular QComboBox. The only customisation is CSS, I removed the colour information:

    @
    QComboBox {
    font-size: 11px;
    margin: 0px;
    padding: 0px 6px 0px 6px;
    border: 1px solid #000;
    border-radius: 4px;
    }
    QComboBox::drop-down {
    subcontrol-origin: padding;
    subcontrol-position: top right;
    width: 20px;
    border: 0px
    }
    QComboBox::on {
    border: 1px solid #000;
    border-radius: 4px;
    }
    QComboBox::checked {
    border: 0px;
    }
    QComboBox::down-arrow {
    image: url(:/Icons/combo-updown-arrow.png);
    }
    QComboBox::down-arrow:disabled {
    image: url(:/Icons/combo-updown-arrow-disabled.png);
    }
    QComboBox QAbstractItemView {
    border: 2px solid gray;
    border-radius: 4px;
    margin: 0px;
    padding: 1px;
    outline: none;
    }
    QComboBox QAbstractItemView::item {
    border: 0px;
    }
    QComboBox QAbstractItemView::item:selected {
    border: 0px;
    }
    @


  • Lifetime Qt Champion

    All in all, it's a pretty big CSS that changes a lot of things.

    It's not the same style that is used to paint the combo box which could explain the look and feel difference.



  • bq. which could explain the look and feel difference.

    I've never seen arrows like that on any other Mac application or with Qt.

    I never encountered them when I was using Qt 4.x or Qt 3.x


  • Lifetime Qt Champion

    Using this style sheet ?



  • Using this style sheet on 4.x and I believe using 5.0.x.

    At some stage of Qt 5's development I noticed that these arrows would appear.

    Actually, sometimes they don't, even with Qt 5.2.0. When I was trying to make the screenshot at the top of the post they stopped appearing. I hadn't changed the window size.


  • Lifetime Qt Champion

    Can you provide a minimal sample code ? Even it's only a standard QComboBox with some data in, that will ensure that everybody is testing with the same base


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.