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 make table header clickable in qt creator
Forum Updated to NodeBB v4.3 + New Features

how to make table header clickable in qt creator

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 514 Views 1 Watching
  • 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.
  • L Offline
    L Offline
    learn_Qt
    wrote on last edited by
    #1

    Hi all, I'm struggling with how to make table header clickable. I'm using tableview. Plz let me know how to make it clickable.

    M 1 Reply Last reply
    0
    • L learn_Qt

      Hi all, I'm struggling with how to make table header clickable. I'm using tableview. Plz let me know how to make it clickable.

      M Offline
      M Offline
      mpergand
      wrote on last edited by
      #2

      @learn_Qt

      Hi,

      Look at signals in HeaderView
      and setSectionsClickable method.

      L 1 Reply Last reply
      1
      • M mpergand

        @learn_Qt

        Hi,

        Look at signals in HeaderView
        and setSectionsClickable method.

        L Offline
        L Offline
        learn_Qt
        wrote on last edited by
        #3

        thanks @mpergand , example plz

        M 1 Reply Last reply
        0
        • L learn_Qt

          thanks @mpergand , example plz

          M Offline
          M Offline
          mpergand
          wrote on last edited by
          #4
          tableView->horizontalHeader()->setSectionsClickable(true);
          connect(tableView->horizontalHeader(),&QHeaderView::sectionClicked, [](int logicalIndex)
              {
                  qDebug()<<"column"<<logicalIndex<<"clicked";
              });
          
          L 1 Reply Last reply
          2
          • R Offline
            R Offline
            Richard115
            Banned
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • M mpergand
              tableView->horizontalHeader()->setSectionsClickable(true);
              connect(tableView->horizontalHeader(),&QHeaderView::sectionClicked, [](int logicalIndex)
                  {
                      qDebug()<<"column"<<logicalIndex<<"clicked";
                  });
              
              L Offline
              L Offline
              learn_Qt
              wrote on last edited by
              #6

              Thanks for your help @mpergand , it's working!! :)

              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