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 show and hide image on tableview column header selection
Forum Updated to NodeBB v4.3 + New Features

How to show and hide image on tableview column header selection

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

    Eg : Image is part of header delegate
    Image {
    id:arrowimgid
    Layout.alignment: Qt.AlignVCenter
    Layout.topMargin: dp(15)
    source: (styleData.column === 1 || styleData.column === 2 || styleData.column === 3
    || styleData.column === 4 || styleData.column === 5 || styleData.column === 6 || styleData.column === 7) ? "images/down-arrow.png" : ""
    opacity: DCMGlobal.roleacces === 0 ? 1.0 : 0.5
    visible: (styleData.column === 1) ? true : false
    }

    As part of connections property doing below things
    Connections {
    target: styleData
    onPressedChanged: {

                                    if(styleData.column === 1 && isSorted === true) {
    
                                        if(tableViewId.sortIndicatorOrder === 0) {
                                            arrowimgid.visible = true
                                            arrowimgid.source = "images/up-arrow.png"
                                        }
                                        else if(tableViewId.sortIndicatorOrder === 1) {
    
                                            arrowimgid.source = "images/down-arrow.png"
                                        }
                                    }
    
                                    if(styleData.column === 2 && isSorted === true) {
    
                                        if(tableViewId.sortIndicatorOrder === 0) {
                                            arrowimgid.visible = true
                                            arrowimgid.source = "images/up-arrow.png"
                                        }
                                        else if(tableViewId.sortIndicatorOrder === 1) {
    
                                            arrowimgid.source = "images/down-arrow.png"
                                        }
                                    }
    
                                    if(styleData.column === 3 && isSorted === true) {
    
                                        if(tableViewId.sortIndicatorOrder === 0) {
                                            arrowimgid.visible = true
                                            arrowimgid.source = "images/up-arrow.png"
                                        }
                                        else if(tableViewId.sortIndicatorOrder === 1) {
    
                                            arrowimgid.source = "images/down-arrow.png"
                                        }
                                    }
    

    }

    Please suggest how to show image on based on selected header and hide image on other columns.

    1 Reply Last reply
    0
    • MarkkyboyM Offline
      MarkkyboyM Offline
      Markkyboy
      wrote on last edited by
      #2
      This post is deleted!
      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