Results 1 to 7 of 7

Thread: programmatic way to determine if in a macro

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2010
    Posts
    6
    Qt products
    Qt4

    Default programmatic way to determine if in a macro

    Howdy,

    I have a custom model with undo/redo implemented via QUndoStack. Some of
    my operations require macros with some complicated logic. Is there any way to
    programmatically determine if you are currently inside an uncompleted macro?

    thanks,
    Danny

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: programmatic way to determine if in a macro

    If you only create macros by creating commands with parents then your commands can check their contructor's "parent" argument to see if they are part of a macro. You can even access the parent's list of children to see if there are more commands to follow.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2010
    Posts
    6
    Qt products
    Qt4

    Default Re: programmatic way to determine if in a macro

    Thanks for the response. This doesn't work so well for me though. Currently, my macros are defined in the view, since that is where the composite actions happen (like copy/delete for DnD "move"). The atomic commands happen in the model.
    They don't know anything about the view and the macros living there, so it is hard to set command parents.

    There is another problem, too. I need to check whether there is macro underway at some point in the view code. I need to decide whether to end the macro or not. I have no handle to a command to see whether it is part of a macro.
    Parents would let me if a command is part of a macro, but not whether a macro is underway or completed.

    thanks again,
    Danny

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: programmatic way to determine if in a macro

    It's hard for me to imagine what is going on in your program. By the way, did you follow the QQ article on using undo/redo with the model-view architecture?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QSqlTableModel programmatic changes
    By jtdavidson in forum Newbie
    Replies: 3
    Last Post: 13th July 2010, 03:29
  2. QT_MODULE() macro error?
    By batileon in forum Qt Programming
    Replies: 0
    Last Post: 4th November 2009, 04:43
  3. Q_OBJECT macro - what exactly does it do?
    By magland in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2007, 10:30
  4. Macro
    By comlink21 in forum Qt Programming
    Replies: 1
    Last Post: 25th July 2007, 11:28
  5. Macro used for debugging
    By sunil.thaha in forum General Programming
    Replies: 11
    Last Post: 30th March 2007, 17:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.