Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to change color of Tree view items on updation of model
Forum Updated to NodeBB v4.3 + New Features

How to change color of Tree view items on updation of model

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 269 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
    sush123
    wrote on last edited by
    #1

    Hi All,

    I have model in cpp which has list of module name and this Model i m setting to Treeview in Qml like below:
    In output i have to show tree structure for each module which has different erros and warnings ,

    TreeView {
    width: parent.width
    height: 200
    headerVisible: false
    backgroundVisible: true
    __horizontalScrollBar.visible: false
    frameVisible: false
    model: myModel //Model from cpp
    style: TreeViewStyle {
    backgroundColor: Colors.menuBodyBackground
    branchDelegate: Rectangle{
    width: 10
    height: 10
    color: Colors.menuBodyTextHeading2
    Image {
    anchors.centerIn: parent
    source: "qrc:/images/Simulate.svg"
    sourceSize: Qt.size(parent.width0.8,parent.height0.8)
    }
    }
    }

            TableViewColumn {
                role: "display"
                width:400
                delegate: tableItemDelegateText
            }
    

    Component {
    id:tableItemDelegateText
    Item {
    Text {
    font.pointSize: 11
    color:styleData.isExpanded ? Colors.treeViewRootItem : Colors.menuBodyTextHeading3
    elide: styleData.elideMode
    text: styleData.value === undefined ? "" : styleData.value
    }
    }
    }
    rowDelegate: Component {
    Rectangle {
    height: 20
    color: isSelected ? Colors.menuBodySelectedRowBackground : Colors.menuBodyBackground
    property bool isSelected: styleData.selected
    }
    }

    The Question is when ever a module receives a new error or warning i need to notify user by changing only perticular "Module" color into Red

    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