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

Merging QUndoCommands when having identical macros

    XMLWordPrintable

Details

    Description

      If a QUndoCommand contains identical macros, mergeWith() is not called. For some reason this is intentional, the code do:

          bool macro = !d->macro_stack.isEmpty();
      
          QUndoCommand *cur = 0;
          if (macro) {
              QUndoCommand *macro_cmd = d->macro_stack.last();
              if (!macro_cmd->d->child_list.isEmpty())
                  cur = macro_cmd->d->child_list.last();
          } else {
              if (d->index > 0)
                  cur = d->command_list.at(d->index - 1);
              while (d->index < d->command_list.size())
                  delete d->command_list.takeLast();
              if (d->clean_index > d->index)
                  d->clean_index = -1; // we've deleted the clean state
          }
      
          bool try_merge = cur != 0
                           && cur->id() != -1
                           && cur->id() == cmd->id()
                           && (macro || d->index != d->clean_index);
      
          if (try_merge && cur->mergeWith(cmd)) {
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            fenglich Frans Englich (closed Nokia identity)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes