Styling a QTreeWidget



  • Hello everyone.

    I'm trying to style a QtreeWidget with the following code

    QString treeWidgetStyle("QTreeWidget { border: 1.5px solid gray; border-radius: 9px; background-color: palette(base); } ");
    ui->treeWidget->setStyleSheet(treeWidgetStyle);
    
    

    my problem is, the header top right and top left are expanding past the radius corners. How would stylesheet the top left and top right corner of the header. I am sorry, I cannot figure out how to attach a image to show.

    Thanks


  • Lifetime Qt Champion



  • Thanks, here's the image, notice the top left and right corners of the header is not within the radius, I'm sure it can be styled somehow I would think.

    alt text



  • http://doc.qt.io/qt-5/stylesheet-examples.html#customizing-qheaderview you basically have to set the radius to the headerview too



  • Hi, and thanks for all your help. I've tried styling which does work however it still produces undesirable results. I have found this on the net..

    Problem with QHeaderView Border Radius but don't understand what his fix is.

    I have the same result, the border has a radius however the whitespace behind it is still drawn outside of this radius.


Log in to reply