Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTreeView setStyleSheet has no effect
Forum Updated to NodeBB v4.3 + New Features

QTreeView setStyleSheet has no effect

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 387 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    soma_yarram
    wrote on last edited by
    #1

    Hello,

    I want to set background color of a selected inactive item in a QTreeView using style sheet as follows:

    MyTreeView->setStyleSheet("QTreeView::item:selected:!active { background-color: rgb(150, 180, 220) }");
    

    But the code has no effect in the tree view, but the similar code works for QTableView.

    Can anyone tell me what I'm missing here?

    Thanks in advance.

    Fuel 0F 1 Reply Last reply
    0
    • S soma_yarram

      Hello,

      I want to set background color of a selected inactive item in a QTreeView using style sheet as follows:

      MyTreeView->setStyleSheet("QTreeView::item:selected:!active { background-color: rgb(150, 180, 220) }");
      

      But the code has no effect in the tree view, but the similar code works for QTableView.

      Can anyone tell me what I'm missing here?

      Thanks in advance.

      Fuel 0F Offline
      Fuel 0F Offline
      Fuel 0
      wrote on last edited by
      #2

      @soma_yarram said in QTreeView setStyleSheet has no effect:

      background-color: rgb(150, 180, 220)

      You missed a ;

      background-color: rgb(150, 180, 220);  //<-----
      
      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved