⚠️ Forum Maintenance: Feb 6th, 8am - 14pm (UTC+2)

Setting style on QTreeWidget root items (PyQT)

  • Is there a way to set a style for only the root items in a QTreeWidget?

    For example if below is my tree, I'd like to set a style on just the "/bob" and "/tom" items.


    I tried this and a few other variations with no luck:

        QTreeView::item:first  {
            background-color: red;

    I've been looking here:


Log in to reply