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

List:       kde-devel
Subject:    Re: connect controls in kxconfig dialogs
From:       Tobias Roeser <le.petit.fou () web ! de>
Date:       2007-05-17 13:55:32
Message-ID: 200705171555.32496.le.petit.fou () web ! de
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Now I reply to my own mail. Annma was so kind to help me finding a solution on 
#kde-devel. The point was, that the enabled state of those fields has be set 
before the dialog is shown which is not possible within the designer and thus 
has to be done from the calling c++ code. I did just that and it worked. 

To document it:

// create the dialog
KConfigDialog* dialog = new KConfigDialog(this, "KThinkBatSettings", 
KThinkBatConfig::self(), KDialogBase::Plain);

// instanciate the generated (by KConfig XT) prefrences panel
Prefs* prefs = new Prefs(this);
assert(prefs);

// Ensure, that an setting which depends on another is only 
// activated, if the requirements are fulfilled
// !!! This solved my problem !!!
prefs->kcfg_AcpiBatteryPath->setEnabled(KThinkBatConfig::enableAcpi());

// add the preferences panet to the dialog
dialog->addPage(prefs, i18n("KThinkBat Preferences"), "configure");

//User edited the configuration - update your local copies of the
//configuration data
connect(dialog, SIGNAL(settingsChanged()), this, 
SLOT(slotUpdateConfiguration()));

// Show the dialog
dialog->show();


Regards,
Tobias

-- 
KThinkBat - the better looking KDE battery status
https://lepetitfou.dyndns.org/kthinkbat

Am Donnerstag, 17. Mai 2007 schrieb Tobias Roeser:
| Hi all,
|
| to make the config dialog of KThinkBat more intuitively, I try to disable
| some comboboxes when the checkbox above them is disabled. I already got
| this working by linking the checkbox signal toggle(bool) to the according
| combobox's slot setEnabled(bool). This is all working fine.
|
| The problem is, that when I freshly open the config dialog, the checkbox is
| enabled, even if the combobox isn't. After toggling the checkbox, the
| combobox will be enabled/disabled again. So, how to set the initial state
| of the combobox depending on the state of the checkbox?
|
| Any hint or good documentation link is welcome.
|
| Regards,
| Tobias Roeser


["signature.asc" (application/pgp-signature)]

>> 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