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 Multiple Editing Cell
Forum Updated to NodeBB v4.3 + New Features

QTableView Multiple Editing Cell

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.2k 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.
  • E Offline
    E Offline
    epalmero
    wrote on last edited by
    #1

    Dear All:

    I am trying to create a QTableView where I use a Costumer model and all that is working perfect. Nonetheless I have an small problem. I would like to be able to edit multiple cell at the same time. This mean that if for example I have a Table of 3 x 3 and I select two elements of column 2 and I change one of this values then I change all of the selected one.

    I think I have a way to do this by listen the dataChanged slot but I have a problem here. As soon as I have double click one of the cell to be able to change it I loose the selection. So the question is how I can do to be able to double click in a cell without loosing the selections?

    All the best
    Ernesto

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ckakman
      wrote on last edited by
      #2

      Hi,

      I'd suggest that you keep the selected cells by reimplementing selectionChanged() and using selectedIndexes() so that you know which cells to update when the users edits one of them.

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

        The problem, I guess, would be distinguishing between the multiple-cell select the user makes, and the single-cell select that is made when you double-click.

        1 Reply Last reply
        0
        • E Offline
          E Offline
          epalmero
          wrote on last edited by
          #4

          Hi Andre:

          Thanks is exactly my problem how I can make the difference between the single click and the double click. It look like that when I double click Qt call the single click in any case and thus why the selection is gone. Any suggestions?

          All the best
          Ernesto

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            The only thing I can think of, is using the time difference between the select action and the double click to determine if it a real selection or the start of an exit action. If the selection is followed by an edit action in the timespace of the double-click interval, I think you should revert to the selection you had before the sequence started.

            1 Reply Last reply
            0
            • E Offline
              E Offline
              epalmero
              wrote on last edited by
              #6

              Thanks very much I will try that one it sound as a good idea.

              Best
              Ernesto

              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