Results 1 to 5 of 5

Thread: Dirty QDialog

  1. #1
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Dirty QDialog

    Hey,

    how do I determine whether a Dialog is dirty (i.e. the values of the widgets were changed)? I could install an event filter but that fires far too often and i am concerned about performance...

    Thanks

    Sebastian

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Dirty QDialog

    all widgets that manage some sort of data, such as text etc, emit signals when their values are changed.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Dirty QDialog

    Ok, but how would you do that in an application with a lot of widgets? I am thinking of undo/redo. Would you need to connect EVERY widget to a method handling the case when something changed?! Or is there a shorcut?

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Dirty QDialog

    you didn't supply almost any details about your code, or the particulars of what you are doing.
    But in a very general way - yes, you have to connect each signal to a slot, if you wan to handle that signal.
    You can have one slot connected to any arbitrary compatible signals though.
    So you could have one slot in your dialog, that sets a "dirty" flag when ever any of the widgets in it changed.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Mar 2010
    Location
    Berlin
    Posts
    19
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Dirty QDialog

    Thank you very much. This is not really about code, it's more about understanding and best practice in Qt.

Similar Threads

  1. QDialog
    By jayreddy in forum Qt Programming
    Replies: 5
    Last Post: 29th December 2009, 09:51
  2. closing a Qdialog called from a Qdialog
    By OverTheOCean in forum Qt Programming
    Replies: 3
    Last Post: 28th September 2009, 08:02
  3. QDialog in DLL
    By markvi in forum Qt Programming
    Replies: 0
    Last Post: 16th September 2009, 10:31
  4. QSqlTableModel Dirty Flag?
    By ChrisW67 in forum Qt Programming
    Replies: 2
    Last Post: 4th September 2009, 09:15
  5. How to "lock" a new qdialog in another qdialog
    By donglebob in forum Qt Programming
    Replies: 7
    Last Post: 4th February 2009, 08:37

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.