KConfigXT Signals

David Jarvie djarvie at kde.org
Sat Jan 9 21:57:11 GMT 2010


On Friday 08 Jan 2010 21:57:33 Keith Rusler wrote:
> On Friday 08 January 2010 04:25:31 Andreas Pakulat wrote:
> > On 08.01.10 03:18:33, Keith Rusler wrote:
> > > I recently started needing signals to be emitted from my configuration
> > > dialogue when certain changes were made like tab position of the main
> > > view, etc. I followed the guide and added them to the settings.kcfg
> > > file. The generated code works perfectly.. All my settings are modifed
> > > and save but none of the signals are emitted when the value is changed
> > > on a KComboBox and I hit OK or Apply button. Is there something that I
> > > probably missed out on as the tutorial barely goes in to details about
> > > it.
> > 
> > Can you show some example of what you tried and what exactly you want to
> > achive. I don't quite understand which signals you mean and what you expect
> > them to trigger or how you added them to the settings.kcfg...
> > 
> > Andreas
> 
> Here is what I added to the settings.kcfg. I placed the <signals> at the 
> beginning of the .kfg 
> 
> <kcfgfile name="akirc" />
> <signal name="serverTabPositionChanged">
>     <argument type="Int">serverTabPosition</argument>
> </signal>
> <signal name="channelTabPositionChanged">
>     <argument type="Int">channelTabPosition</argument>
> </signal>
> ....
> <entry key="serverTabPosition" type="Int">
>     <emit signal="serverTabPositionChanged" />
> </entry>
> <entry key="channelTabPosition" type="Int">
>     <emit signal="channelTabPositionChanged" /> 
> </entry>
> 
> Basically what I'm trying to achieve is when the user changes the KComboBox 
> value it will change the Server and Channel's Tab Position to top, bottom, 
> left or right. 
> 
> void serverTabPositionChanged(int index)
> {
>     kDebug() << "Index: " << index;
>     switch (Aki::Settings::serverTabPosition()) {
>     case 0: {
>         q->setTabPosition(QTabWidget::North);
>         break;
>     }
>     case 1: {
>         q->setTabPosition(QTabWidget::South);
>         break;
>     }
>     case 2: {
>         q->setTabPosition(QTabWidget::West);
>         break;
>     }
>     case 3: {
>         q->setTabPosition(QTabWidget::East);
>         break;
>     }
>     }
> }
> 
> This is the slot that is connected to the serverTabPositionChanged. The only 
> time I see the changes is when I restart the application.

What is the code in your application which changes the relevant configuration settings?

-- 
David Jarvie.
KDE developer.
KAlarm author -- http://www.astrojar.org.uk/kalarm




More information about the kde-core-devel mailing list