I called 'enableButtonApply(true) on my dialog if the user changed the
color, but when the user clicks 'Apply' no other signal gets emitted
from KConfigDialog.
What signal should i emit if the data in this KConfigDialog has changed?
I tried to emit 'settingsChanged(QString)' but that applies the settings
directly without giving the user a chance to click 'cancel' and dismiss
the settings.
Many thanks in advance for any help on that.
Greetings, -chris-
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
If you're using KConfigXT the most correct solution is to let
KConfigXT know how to use your new class, rather than loading/saving
manually.
I'm assuming you have a class for your button.
in MyButtonClass add a Q_PROPERTY to set/write this colour. Specify
this property as "USER".
http://qt-project.org/doc/qt-4.8/properties.html
I'm guessing KConfigXT was written before the NOTIFY part of a
q_property, so it has a manually stored map of signals to know when a
setting has changed.
You can add to this at runtime. (do this before the UI has loaded)
KConfigDialogManager::changedMap()->insert("MyButtonClass",
SIGNAL(somethingUpdated(QColor)));
http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKConfigDialogManager.html
In theory now KConfigXT will handle everything for you.
(btw, have you checked that KColorButton isn't what you want)
For a working code sample, look in SVN at
trunk/KDE/kdegames/palapeli/src/config. In the config dialog, one can
select a background pattern for the game area, and selecting "Plain
color" enables a KColorButton where the color can be chosen.
I don't remember at the moment if I use KConfigXT, but the pattern
presented there can definitely be applied to KConfigXT.
Greetings
Stefan