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. Enhancement to QUndoStack::endMacro

Enhancement to QUndoStack::endMacro

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 515 Views
  • 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.
  • G Offline
    G Offline
    GougMcGrath
    wrote on last edited by
    #1

    I apologize if this isn't the right forum. If not, please direct me elsewhere.

    I'm frustrated with the limitation of QUndoStack::endMacro in that it always creates an undo command on the stack even if there weren't any intervening children. In the graphic editor code I work on, I quite often need to start a macro that encapsulates potentially many operations scattered over a number of classes, and there's always the possibility that the user didn't actually do anything during the procedure (beginning a text edit and canceling, for example).

    The beginMacro/endMacro mechanism is great if you're sure that there will be intervening undo operations added to the stack, but if not, then the stack always has an empty undo command with text that appears on the actions and tooltips, and that's very confusing to the user.

    It seems to me that it should be very trivial to change the endMacro signature to:

     void endMacro (bool discard_if_empty = false);
    

    The default behavior would be unchanged. If the flag is set to true, then, if the internal macro parent has no children, it gets discarded rather than added to the stack. It would clean up a lot of messy code and make this much more useful.

    Is there a technical reason why this change couldn't be done? Or is it just a choice that's been made by the architects of Qt?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! Maybe you want to discuss this with the devs on the mailing list. They can help you to write a patch :-)

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved