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. Strange behavior on Column pinning QTableWidget
Forum Updated to NodeBB v4.3 + New Features

Strange behavior on Column pinning QTableWidget

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 247 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.
  • A Offline
    A Offline
    ajaxcrypto
    wrote on last edited by
    #1

    I have written a QTableWidget whose first two columns are pinned i.e. always remains in view even if horizontally scrolled based on https://doc.qt.io/qt-5/qtwidgets-itemviews-frozencolumn-example.html

    My selection mode is per row, one row at a time. When I click on any row within the pinned columns, the selection works correctly, however, when I click on any row and the column is outside the pinned ones (to the right), a strange behavior is displayed i.e. the 1st pinned column (column #0) gets hidden and the first non-pinned column (column #2) gets displayed twice, adjacent to each other.

    What could be the possible culprit? I have planted breakpoints in all the methods I override, it doesn't hit anything at all. Does it have anything to do with the two QTableViews sharing the same selection model? Should it be separate?

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ajaxcrypto said in Strange behavior on Column pinning QTableWidget:

      What could be the possible culprit?

      Please provide a minimal, compilable example - otherwise we can just do wild guesses.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ajaxcrypto
        wrote on last edited by
        #3

        I finally figured it out with lots of trial and error. The culprit was sharing of item selection model across the two views. Had to keep them independent and synchronize on signals instead.

        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