PDA

View Full Version : Auto applying preferences



ABBAPOH
6th December 2011, 11:02
Is there any solution for mac os style preferences dialog, when setting are applied in time user edits properties in widgets (without an "apply" button)?
Functionality seems similar to QDataWidgetMapper, however i don't see advantages of using mapper (i will need "SettingsModel" in that case; also it is not very comfortable to assign mapping to they model as long as mapper works with single column/row, while i need to map whole settings tree)

I saw KAutoConfig class, however it has all standard widgets hardcoded in it and it sets settings while user changes properies, which is not always appropriate, i think much better to use behavior of QItemDelegate - accept on pressing "return" or loosing focus and reject on pressing "esc". However monitoring properties should also be possible - sliders should not be confirmed, for example.

Any ideas how to implement that feature properly?

ChrisW67
7th December 2011, 00:24
I saw KAutoConfig class, however it has all standard widgets hardcoded in it and it sets settings while user changes properies, which is not always appropriate, i think much better to use behavior of QItemDelegate - accept on pressing "return" or loosing focus and reject on pressing "esc".
So don't code your dialog like that.
For line edits only update the underlying setting after each key press if a validator says the value is acceptable (not intermediate or unacceptable). If you want to update the underlying setting when focus is lost or enter is pressed look for the editingFinished() signal.
For sliders simply update the underlying settings every time you get the valueChanged() signal (assuming the range is all acceptable).
For check boxes and radio boxes you can update on every toggled() or clicked() signal.

In short, there is no QMacStyleOptionsDialog.