Results 1 to 3 of 3

Thread: turning widgets to original state

  1. #1
    Join Date
    Apr 2009
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default turning widgets to original state

    Hi,

    Sorry, I'm a beginner, but I'm not sure if this is a beginner question or not. I am using PyQt 4 and Python 2.6.

    After initializing the GUI that I have developed, the user may change a few things, but is there a way for the GUI's widgets to return to its default or original state, like the state it was when it was first loaded? E.g. the tables were initially empty, so all the tables would go back to being empty?

    Is there an existing function to accomplish this, or do I have to manually code to undo all the changes?

    Regards,
    Helvin

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    507
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: turning widgets to original state

    Hi, there is QUndoStack and friends, but I think those are overkill in your case. The simplest way would probably be to just store the initial value somehow (you could subclass your widget and add a "reset" method) and use this to re-init your widgets.

    Ginsengelf

  3. The following user says thank you to Ginsengelf for this useful post:

    helvin (21st September 2009)

  4. #3
    Join Date
    Apr 2009
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: turning widgets to original state

    wow! Thanks Ginsengelf! Even if I don't use undostack to undo everything in my GUI, it will definitely be handy for my GUI's undo button. Thanks for the fast reply!

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.