[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Using custom controls in KConfigXT
From:       David Edmundson <david () davidedmundson ! co ! uk>
Date:       2012-03-19 10:45:35
Message-ID: CAGeFrHCFbqTpkte8N8ZKz866JOQP=02Sd2pCy9yowMyykih6aw () mail ! gmail ! com
[Download RAW message or body]

On Mon, Mar 19, 2012 at 8:19 AM, Christian Taubenheim
<c.taubenheim@q-bus.de> wrote:
> Hi all,
> i use the KConfigXT concept for managing settings of my app.
> I also managed to implement a QButton that holds a user specified color (by
> opening a QColorDialog), which is transferred into the settings manually.
>
> 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-
>

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)
>
>
>>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe
>>> <<

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic