Results 1 to 2 of 2

Thread: How do I detect change of state for any widget in a page

  1. #1
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    254
    Thanks
    92
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default How do I detect change of state for any widget in a page

    I have a QListWidget with 5 items and on click of each item, I'm showing corresponding widget pages which are in a stacked layout. I call whole of these as settings page which is similar to Microsoft Security Essentials settings tab. Pic of Microsoft Security Essentials - settings tab

    Now on change of state in any of the widgets in the stacked layout, I need to enable "Save" and "Cancel" buttons. For example user changes check state or QComboxItem, or any of those widgets in each of the stacked layout. Do I need to connect all the widgets' state change signals to one slot ? Is there any better way to find change in any of the widgets state in the page at one go ? How do I find that ?
    Thank you.
    Last edited by rawfool; 19th July 2013 at 14:55.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How do I detect change of state for any widget in a page

    Do I need to connect all the widgets' state change signals to one slot ? Is there any better way to find change in any of the widgets state in the page at one go ? How do I find that ?
    Yes, mostly. Each page widget could do this for its own widgets (using changed or editingFinished()) and send an isDirty(bool) signal. In the widget containing the stack you connect that signal from each page to a slot that logically combines them and updates the Save/Cancel buttons. Or, you could have the parent widget poll a public function isDirty() on each page on some timer or otherwise triggered basis.
    Is there any better way to find change in any of the widgets state in the page at one go ?
    There a many possible ways to arrange this but none are without work.
    How do I find that ?
    You don't.

Similar Threads

  1. Change state property within a current state?
    By prophet0 in forum Qt Quick
    Replies: 1
    Last Post: 30th May 2012, 19:23
  2. QFileSystemWatcher best way to detect change
    By hakermania in forum Qt Programming
    Replies: 2
    Last Post: 12th October 2011, 15:51
  3. Replies: 0
    Last Post: 23rd December 2010, 07:40
  4. Change position according to QCheckBox State
    By champ in forum Qt Programming
    Replies: 5
    Last Post: 6th June 2010, 18:37
  5. Is there any way to detect USB state?
    By Kode.Cooper in forum Qt Programming
    Replies: 6
    Last Post: 15th December 2009, 01:39

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.