Need stylsheet coaching



  • Hi,

    this is my stylesheetcode:

    "QTreeWidget{border-style:none; background-color:rgba(0,0,0,0); color:rgb(255,255,255); selection-background-color:transparent;} QTreeWidget::item:hover,QTreeWidget::item:hover:selected{border-radius:5px;border-style:none;border-width:1px;border-color:rgb(100,100,100); background-color:rgba(255,255,255,100);}QTreeWidget::item:selected{background-color:rgba(255,255,255,0);}"
    

    and this is the result:

    Most is intended but if something is selected there is that dotted border around the text and if you look carefully you'll notice that the icon. I want to remove all this.
    the white background on selected is already removed as you can see in the code



  • @QT-static-prgm said in need stylsheet coaching:

    Hi,

    this is my stylesheetcode:

    "QTreeWidget{border-style:none; background-color:rgba(0,0,0,0); color:rgb(255,255,255); selection-background-color:transparent;} QTreeWidget::item:hover,QTreeWidget::item:selected{border-radius:5px;border-style:none;border-width:1px;border-color:rgb(100,100,100); background-color:rgba(255,255,255,100);}"
    

    and this is the result:

    Most is intended but if something is selected there is that dotted border around the text and if you look carefully you'll notice that the icon. I want to remove all this.

    As far as i remember , you need to set the outline property

    outline: 0;
    

    I also advice you to have a look at list of available properties in stylesheet

    doc.qt.io/qt-5/stylesheet-reference.html#list-of-properties

    Hope this can help ! if not keep me informed



  • running the final program it looks like this:

    So there is no dotted line. Needs to be something else. But why is it that white??

    The reference i already found and used. But i found nothing that explains the blueish hue of the icon (only the icon) and why transparent is not transparent (as you can see on the new image the white highlight.)

    my old stylesheet variant (put everything in one line) was ok when the code was shorter. Now i read the stylesheet from a file, so it's better readable:

    QTreeWidget {
    	border-style:none;
    	background-color:rgba(0,0,0,0);
    	color:rgb(255,255,255);
    	selection-background-color:transparent;
    }
    
    QTreeWidget::item:hover,QTreeWidget::item:hover:selected {
    	border-radius:5px;
    	border-style:none;
    	border-width:1px;
    	border-color:rgb(100,100,100);
    	background-color:rgba(255,255,255,100);
    }
    
    QTreeWidget::item:selected {
    	background-color:rgba(255,255,255,0);
    	outline:0;
    	border-style:none;
    }
    


  • @QT-static-prgm said in need stylsheet coaching:

    running the final program it looks like this:

    So there is no dotted line. Needs to be something else. But why is it that white??

    The reference i already found and used. But i found nothing that explains the blueish hue of the icon (only the icon) and why transparent is not transparent (as you can see on the new image the white highlight.)

    my old stylesheet variant (put everything in one line) was ok when the code was shorter. Now i read the stylesheet from a file, so it's better readable:

    QTreeWidget {
    	border-style:none;
    	background-color:rgba(0,0,0,0);
    	color:rgb(255,255,255);
    	selection-background-color:transparent;
    }
    
    QTreeWidget::item:hover,QTreeWidget::item:hover:selected {
    	border-radius:5px;
    	border-style:none;
    	border-width:1px;
    	border-color:rgb(100,100,100);
    	background-color:rgba(255,255,255,100);
    }
    
    QTreeWidget::item:selected {
    	background-color:rgba(255,255,255,0);
    	outline:0;
    	border-style:none;
    }
    

    have you tried to add

    border: none;
    

    ?



  • just tried, did not work.

    QTreeWidget,* {
    	border-style:none;
    	background-color:rgba(0,0,0,0);
    	color:rgb(255,255,255);
    	selection-background-color:transparent;
    	show-decoration-selected:0;
    }
    
    QTreeWidget::item:hover,QTreeWidget::item:hover:selected {
    	border-radius:5px;
    	border-style:none;
    	border-width:1px;
    	border-color:rgb(100,100,100);
    	background-color:rgba(255,255,255,100);
    }
    
    QTreeWidget::item:selected {
    	background-color:rgba(255,255,255,0);
    	show-decoration-selected:0;
    	border:none;
    }
    

    changing the background-Color from QTreeWidget::item:selected to 0,0,0,0 makes a black border and background around it.

    I just noticed that if the window has no focus the white highlight is gone.

    So i tried this:

    QTreeWidget::item:selected, QTreeWidget::item:focus {
    	background-color:rgba(255,255,255,0);
    	show-decoration-selected:0;
    	border:none;
    }
    

    and this

    QTreeWidget::item:selected, QTreeWidget::item:selected:focus {
    	background-color:rgba(255,255,255,0);
    	show-decoration-selected:0;
    	border:none;
    }
    

    But it disables just the hover from selected items.

    And the other problem is the blue hue on the icon. Why is it blue???


Log in to reply
 

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