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. How to set BG color for Tree item.
Forum Updated to NodeBB v4.3 + New Features

How to set BG color for Tree item.

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 225 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
    summit
    wrote on last edited by
    #1

    In my TreeView i can scroll to any Item using ScrollTo

    TreeModel* myModel = qobject_cast<TreeModel*>(currentTreeView->model());
    	QModelIndex indexTreeItem = myModel->indexForTreeItem(item);
    	elementTreeView->setCurrentIndex(indexTreeItem);
    	elementTreeView->scrollTo(indexTreeItem);
    
    How can i set the BG color of the item that i scroll to , currently it is in light color i want it to be more dark.
    
    jsulmJ 1 Reply Last reply
    0
    • S summit

      In my TreeView i can scroll to any Item using ScrollTo

      TreeModel* myModel = qobject_cast<TreeModel*>(currentTreeView->model());
      	QModelIndex indexTreeItem = myModel->indexForTreeItem(item);
      	elementTreeView->setCurrentIndex(indexTreeItem);
      	elementTreeView->scrollTo(indexTreeItem);
      
      How can i set the BG color of the item that i scroll to , currently it is in light color i want it to be more dark.
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @summit See "Customizing QTreeView" in https://doc.qt.io/qt-6/stylesheet-examples.html
      Especially QTreeView::item:selected part.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      S 1 Reply Last reply
      4
      • S summit has marked this topic as solved on
      • jsulmJ jsulm

        @summit See "Customizing QTreeView" in https://doc.qt.io/qt-6/stylesheet-examples.html
        Especially QTreeView::item:selected part.

        S Offline
        S Offline
        summit
        wrote on last edited by
        #3

        @jsulm Thank you very much , This is what i needed.

        1 Reply Last reply
        0

        • Login

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