El Sunday 06 March 2016, a les 13:03:26, Frederik Schwarzer va escriure: > Am Sonntag, 6. März 2016, 12:20:38 schrieb Albert Astals Cid: > > El Saturday 05 March 2016, a les 08:34:27, Frederik Schwarzer va > > escriure: > > > Hi, > > > > > > I am struggling with using KConfigDialog. If I use it like this: > > > KConfigDialog* dialog = new KConfigDialog(this, > > > > > > "settings", Settings::self()); > > > > > > connect(dialog, &KConfigDialog::settingsChanged, > > > > > > this, &MainWindow::loadSettings ); > > > > > > dialog->show(); > > > > > > the Help button works. > > > > > > Since in my use case, some of the values in the dialog are > > > calculated and (to my understanding) cannot be handled correctly > > > by Kcfg, I want> > > > > > > to get rif of the "Restore Defaults" button. So I add this line: > > > dialog->setStandardButtons(QDialogButtonBox::Ok | > > > > > > QDialogButtonBox::Cancel | QDialogButtonBox::Help); > > > > As a side note, there's ways in which you can make it so the > > "restore default" button does execute some code for those "tricky" > > settings (i.e. override updateWidgetsDefaults) > > Hmm, updateWidgetsDefaults() is protected. Would I not have to make my > own Dialog and inherit from KConfigDialog to overwrite that?
Yes. > > > > but then the Help button does not open the Help browser anymore. > > > Is that expected? Do I use KConfigDialog incorrectly? Is this just > > > broken on my system? > > > > > > In case someone wants to see what is happening, I created a semi- > > > > > > minimal buildable example to play with. See: > > > https://quickgit.kde.org/?p=scratch%2Fschwarzer%2Fkconfigexamp > > > le.git > > > > As Thomas says you have to recreate the connections, so basically > > > > connect(buttonBox->button(QDialogButtonBox::Help), > > > > SIGNAL(clicked()), q, SLOT(showHelp())); > > This was done before during the KF5 porting but it did not open the > correct halp page. That is very surprising giving how it's exactly what the KConfigDialog code does. Worth investigating if you have some time. Cheers, Albert