Pregunta

I tried many different options to style a QCombobox but I still have some issues on mac osx. It looks like this : look on osx http://img90.imageshack.us/img90/9550/stylesheets.png

I'd like to remove the white top/bottom of the view list but I can't seem to find a way to do this.

Here's the code I have now :

QComboBox{
    color:rgba(200,200,200,255);
    background-color:rgba(71,71,71,255);
    selection-color:rgba(243,149,0,255);
    selection-background-color:rgba(71,71,71,255);
}
QComboBox QAbstractItemView{
    border-radius:0px;
    border:0px;
    selection-background-color:rgba(71,71,71,255);
    background:rgba(71,71,71,255);
    color:rgb(200,200,200);
}

Any help is appreciated

Thanks

¿Fue útil?

Solución

Use own application style (based on QProxyStyle) & override QProxyStyle::styleHint as:

    int CMyProxyStyle::styleHint( StyleHint hint, const QStyleOption*
    option = 0, const QWidget* widget = 0, QStyleHintReturn* returnData =
    0 ) const   
    {
        if( SH_ComboBox_Popup == hint )
          return 0;//disable combo-box popup top & bottom areas
        return QProxyStyle::styleHint( hint, option, widget, returnData );   
    }

install own style to qApp instance:

    qApp->setStyle( new CMyProxyStyle );

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top