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. QTableView drag/drop question
Forum Updated to NodeBB v4.3 + New Features

QTableView drag/drop question

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.6k 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.
  • R Offline
    R Offline
    rwilliams
    wrote on last edited by
    #1

    Hi,

    I have a QTableView with a subclassed model. The QTableView has 1 visible column and 2 hidden columns.Everything seems to be working fine except for the drag/drop operation needed to allow users to order the rows. The drag/drop will only move the first column (the visible column). The 2 hidden columns aren't handled. The overloaded model's setData() only gets called with the model index for the visible column. Everything
    works fine if the 2 hidden columns are set to visible.

    I was thinking of just storing all of the data in the first column as a list but then that sort of circumvents using a QTableView in the first place. Should I be overloading the QAbstractItemModel::dropMimeData or try something else?

    thanks in advance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      msue
      wrote on last edited by
      #2

      Did you set the selection behavior to rows? setSelectionBehavior(QAbstractItemView::SelectRows)

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rwilliams
        wrote on last edited by
        #3

        Yes, the selection behavior is set to select rows. The row(s) do move in entirety when the columns are visible.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          msue
          wrote on last edited by
          #4

          This sounds like a bug, then, I would say. You can publish it in the bug tracker: https://bugreports.qt-project.org

          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