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. Undo/redo problem[solved]
Forum Updated to NodeBB v4.3 + New Features

Undo/redo problem[solved]

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

    hi, i'm having a problem implimenting undo with QUndoStack and QUndoCommand
    i created the @QAction *undoAction; @

    in the header file,and in the constructer i did this
    @undoAction = undoStack->createUndoAction(this, tr("&Undo"));@

    then push a command into the stack "i know that the command got pushed because i saw it with the debuger"

    but when i run the program and press undo the function that i implimented in the command::undo() doesn't get excuted
    but when i call
    @undoStack->undo();@

    using an other button the function that i implimented in the command::undo() excutes

    i hope my question makes sens ,and i will provide any other details

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you post your Qt/OS versions ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        karim24
        wrote on last edited by
        #3

        ok,sorry that i bothered you
        but i solved the problem,the problem was that, in the constructer i allocated the undoStack two times
        @ undoStack = new QUndoStack(this);@

        then
        @ undoStack = new QUndoStack(this);@

        i deleted one and now runs fine

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          No worries and thanks for sharing the solution !

          Don't forget to update the thread title prepending [solved] so other forum users may know a solution has been found :)

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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