PDA

View Full Version : KListWidget item settings



ComaWhite
27th January 2009, 05:48
I have a KListWidget which will be filled with some names by the user. And when the user selects one of the items. Each of those items has its own settings everywhere in the dialog, checkboxes, another KListWidget which can have many strings, spinboxes etc. And wondering what would be a good way to perform this kinda of work. I will have KConfigXT store it because I will have an option to import/export all of this too

wysota
27th January 2009, 09:35
I'd use a data model and something like QDataWidgetMapper to make sure all widgets get updated automatically when a new user is chosen.

ComaWhite
28th January 2009, 00:53
Thank you didn't even know there was a Mapper for Data widgets. But the only problem is how can I make KConfigXT store it all. Because I don't think you can store stuff like that?

wysota
28th January 2009, 01:54
To be honest I have no idea how KConfigXT works but from what I see it is an xml file and a widget that can operate on it. If that is the case then creating a model out of the settings shouldn't be a problem and then you can use a mapper with it. Also storing a list in the file itself shouldn't be a problem, I'm sure it supports whatever QSettings supports and more and storing hierarchies (using groups or arrays) with QSettings is a usual thing to do.

Just to make sure - we are talking KDE4 here, right?

ComaWhite
28th January 2009, 01:58
Yeah I'm using 4.2.60 KDE. And KConfigDialog with the KConfigXT. Going to try and make all those warning disappear too. Because the UI isn't tired to the ServerPage yet.

Network ServerList
------------ -------------------
FreeNode ------------------------> irc.freenode.net, irc.freenode2.net
EFNet ---------------------------> irc.efnet.org irc.efnet2.org

Stuff like that so yeah. I'm looking through KDE4 docs but not finding nothing.

ComaWhite
28th January 2009, 07:25
Well I figured it out how to get it to work the only problem is that it's going to be a nightmare to implement :eek:. I have to write a custom KConfig setup to make the process a little easier and create the groups so that they appear like

[Freenode]
.....
Servers=irc.freenode.net, irc.freenode2.net
Channels=##C++,#Qt
.....

And just iterate through the group list and append them. Just need to read over the mapper and I should be good to go