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 do I emit signal while clicking TableViewColumn?
QtWS25 Last Chance

How do I emit signal while clicking TableViewColumn?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
tableviewcolumnmouseareadelegate
1 Posts 1 Posters 819 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.
  • M Offline
    M Offline
    Mira13
    wrote on 30 Nov 2015, 12:06 last edited by
    #1

    I would like to add a MouseArea or Button to a TableViewColumn to perform specific tasks. However, if I add one of the above type, it overrides the "click" event of TableViewColumn so that I lose row selection by click.

    Here is an example code. The row is not switching when I click it in the area of the last column:

    TreeView {
    clip: true id: mapsTreeView
    objectName: "mapsTreeView"
    model: theModel

    TableViewColumn {
        width: 100
        role: "name_role"
        title: "Map"
    }
    TableViewColumn {
        width: 50
        role: "description_role"
    }
    TableViewColumn {
        id: imageColumn
        width: 20
        role: "image_role"
        delegate: Item {
            MouseArea {
                anchors.fill: parent
                onClicked: {
                    mapsTreeView.sigChangeState()
                }
            }
            Image {
                anchors.fill: parent
                width: 5
                source: "icon" + styleData.value + ".png"
            }
        }
    
    }
    signal sigChangeState()
    

    }

    1 Reply Last reply
    0

    1/1

    30 Nov 2015, 12:06

    • Login

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