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. [Solved] QTableWidget select rows without vertical header

[Solved] QTableWidget select rows without vertical header

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.9k 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
    SKolaMunn
    wrote on last edited by
    #1

    Is it possible to make a QTableWidget that has its vertical header hidden but still lets you select rows (by clicking individual items)? I've tried different combinations of setSelectionMode and setSelectionBehavior and setting the item flags to have the items be selectable but I can't seem to get it to work. It appears that I must have the header column visible and click a header item to select a row. Is this true?

    I assume I can make a slot that is called when an item is selected and then select that item's row? Or I can show my vertical header and just set the items' text to empty and use the header to select the rows. Just wondering if there's a "cleaner" way to do this and I'm just missing something.

    Thanks.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SKolaMunn
      wrote on last edited by
      #2

      Forget it! I figured it out, so in case it helps anyone... I just needed to turn OFF the ItemIsSelectable flag (its off by default but I was turning it on). Now when I click any cell my row is selected (because I setSelectionBehavior(QAbstractItemView::SelectRows) left selection mode as the default.

      I was setting one option too many. Now I have my vertical header hidden and I can still select rows by clicking a single item in the row.

      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