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?


> > 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. So I removed that part and used the StardardButtons 
to make the help work. ... Leading to other problems. :)

Kigo is q bit complicated in this regard. Even now Applying settings 
with an invalid Go command is breaking the whole game until the next 
restart.
My goal would be to get rid of the "tricky" part alltogether and just 
let the standard config dialog handle everything but it's a lot of 
fiddling to find out what can be done and what can't.

Thanks,
Frederik

Reply via email to