[SOLVED] QListWidget style sheet - transperent background with custom check box.



  • I need to use icon as a check box in my QListWidgetItem, also I need transparent background for my list widget.I don't know style shets. Can anybody help me please ?
    The code that I have:
    @setStyleSheet("QListWidget::indicator:checked { image: url(:/Console/ButtonTemplate/RedLedOn.png)}
    QListWidget::indicator:unchecked { image: url(:/Console/ButtonTemplate/RedLedOff.png)}
    QListWidget::indicator:indeterminate { image: url(:/Console/ButtonTemplate/WhiteLedOff.png)}
    QListWidget::indicator { width: 24px; height:24px; }");
    //QWidget::background: transparent;};");
    //background: transparent;");@
    The result is custom check icon with custom size, but no transparent background and no shifting of text, I need to move text for about 2-3 px to the right border.



  • Here is solution: @setStyleSheet("QListWidget::indicator:checked { image: url(:/Console/ButtonTemplate/RedLedOn.png)}
    QListWidget::indicator:unchecked { image: url(:/Console/ButtonTemplate/RedLedOff.png)}
    QListWidget::indicator:indeterminate { image: url(:/Console/ButtonTemplate/WhiteLedOff.png)}
    QListWidget::indicator { width: 24px; height:24px; }
    QListWidget::item { padding-left: 0px; }
    QListView::item:text {color: black;}
    QListView {background: transparent;}");@
    Thanks, everyone.


Log in to reply
 

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