Hi plasma devs! Some of you may know recently i've tried in many ways to group applets visually inside the containment. I tried to embed applets in applets but it brought many problems, then containment in qgraphicsproxywidget in applet in containment but it brought other problems.
Then i started working with an other approach: i wrote a subclass of Plasma::Applet, AbstractGroup, that is the base class for all the GroupApplets. it has some functions such as - assignApplet(Plasma::Applet) - layoutApplet(Plasma::Applet) - saveAppletLayoutInfo(Plasma::Applet *applet, const KConfigGroup &group) - restoreAppletLayoutInfo(Plasma::Applet *applet, const KConfigGroup &group) Then i created a desktop containment and reimplemented some things: - when an applet is added it checks if its pos() is contained in some group geometry() and in the case it calls group->assignApplet(applet) - reimplemented saveContents so that for each applet if it is managed by a group it saves an entry Group=group_id in the applet's config and calls group->saveAppletLayoutInfo(applet, kconfiggroup) - reimplemented restoreContents so that it reads the Group entry and calls group->assignAppelt(applet) and group->restoreAppletLayoutInfo(applet, kconfiggroup) in saveAppletLayoutInfo the group creates a KConfigGroup (that is [Applets][id] [GroupInformation]) and inside it it writes config specified to that one group. so, e.g, i wrote a grid group so it saves row and column, but one could write a stack group so it saves the index. restoreAppletLayoutInfo obviously does the contrary. the configuration of a group is saved under [Containment][id][Groups][id], so that the containment doesn't risk to confuse between groups and simple applets. Now i hope i've explained myself and i'm asking you: what should i do with this? I was thinking between two possibilities: should i merge this with Plasma::Containment? Please note that the containment doesn't know *anything* about how the groups manage the applets inside them. it knows only if they are grouped and, in the case, the id of their group. nor the applets knows anything about how they are arranged. It is all done internally in the groups. Or should i write a subclass of Containment that has group support so one could use this to write a desktop or panel with grouping support? I'd aim at the first one choice, because it would add little more complexity in the containment code but, on the other hand, all the containments would have this support for free. you can find the code in playground/base/plasma/containments/groupingdesktop/ What do you think? Giulio. _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel