PDA

View Full Version : How do I detect change of state for any widget in a page



rawfool
19th July 2013, 14:38
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 (http://farm3.static.flickr.com/2700/4084608503_e985eba07c.jpg)

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.

ChrisW67
19th July 2013, 23:20
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.