Qt Creator and dynamic property



  • I try to use stylesheet dynamic property on qt creator without succes ...

    
    ****** in qtcreator stylesheet ****************
    QComboBox  {color: black; border: 3px solid #5E749C;text-align: top;padding: 4px;border-radius: 7px; border-bottom-left-radius: 7px;background: white;width: 15px;height: 54px;} /* with or whitout is the same*/
    QComboBox [urgent = false] {color: black; border: 3px solid #5E749C;text-align: top;padding: 4px;border-radius: 7px; border-bottom-left-radius: 7px;background: white;width: 15px;height: 54px;}
    QComboBox [urgent = true] {color: black; border: 3px solid #5E749C;text-align: top;padding: 4px;border-radius: 7px; border-bottom-left-radius: 7px;background: green;width: 15px;height: 54px;}
    QComboBox:drop-down {color: black; border: 3px solid #5E749C;text-align: top;padding: 4px;border-radius: 5px; border-bottom-left-radius: 5px;background: QLinearGradient( x1: 0, y1: 0, x2: 1, y2: 0,stop: 0 #fff, stop: 1 #eee,stop: 0.5 #ddd,stop: 1 #eee );width: 44px;  max-height: 44px;}
    QComboBox:down-arrow {image: url(/home/b/res/downarrow.png); width: 24px; height: 24px;}
    
    
    /*******  then in main windows function foo *******/
    
            ui->m1comboBox->setProperty("urgent", true);
            ui->m1comboBox->style()->unpolish(ui->m1comboBox);
            ui->m1comboBox->style()->polish(ui->m1comboBox);
            //ui->m1comboBox->update(); /* with or without is the same*/
    

    but nothings appens ...

    regards
    Giorgio


  • Lifetime Qt Champion

    Hi,

    That's because your stylesheet is wrong, there should be no space between QComboBox and [.



  • works like a charm...
    regards
    giorgio


Log in to reply
 

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