Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-55208

QUndoView selection is messed up

    XMLWordPrintable

    Details

      Description

      The following snippet creates a QUndoStack with 3 undo commands and a QUndoView.

      If you build this example with Qt 5.4.1, clicking on 'command 3' causes only command 3 to be selected (correct).

      If you build this example with Qt 5.6.1, clicking on 'command 3' causes all items in the view to be selected (incorrect).

      Regression introduced in Qt 5.6.x or possibly Qt 5.5.x.

      See attached screenshots.

      #include <QtGui>
      #include <QtWidgets>
      
      struct Command : public QUndoCommand
      {
          Command(const QString &text) : QUndoCommand(text)
          {}
      
          void undo()
          {
              qDebug() << "undo " + text();
          }
      
          void redo()
          {
              qDebug() << "redo " + text();
          }
      };
      
      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QUndoStack stack;
          stack.push(new Command("command 1"));
          stack.push(new Command("command 2"));
          stack.push(new Command("command 3"));
      
          QUndoView view(&stack);
          view.show();
      
          return app.exec();
      }
      

        Attachments

        1. qtbug55208.zip
          1 kB
        2. QUndoView_Qt541.png
          QUndoView_Qt541.png
          12 kB
        3. QUndoView_Qt561.png
          QUndoView_Qt561.png
          12 kB

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              mmutz Marc Mutz
              Reporter:
              danny77uk Daniel
              Votes:
              7 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes