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)

> 
> 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%2Fkconfigexample.git

As Thomas says you have to recreate the connections, so basically

        connect(buttonBox->button(QDialogButtonBox::Help), SIGNAL(clicked()), 
q, SLOT(showHelp()));

Cheers,
  Albert

> 
> I am thankful for any hint. :)
> 
> Regards,
> Frederik

Reply via email to