Spacing in a plasma applet
Jesús Fernández
jesusfs at gmail.com
Fri Apr 30 13:38:42 CEST 2010
> thanks for fwd'ing it on, Alessandro ...
Thanks, I couldnt find any plasma list on lists.kde.org.
> probably it's spacing the icons out because the size policy and/or size hint
> for the plasmoid is set to "expanding". if you set the size policies to not be
> expanding, then when it is put into the panel it will not take up more space,
> resulting in gaps between the icons.
Thanks for the replies, I tried playing with the size policies and it
kind of works. This is the code I'm using in the init() method of the
Applet:
if self.containment().formFactor() == Plasma.Vertical:
self.layout = QGraphicsLinearLayout(Qt.Vertical, self.applet)
qsp = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed,
QSizePolicy.PushButton)
else:
self.layout = QGraphicsLinearLayout(Qt.Horizontal, self.applet)
qsp = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed,
QSizePolicy.PushButton)
self.layout.setSpacing(0)
self.applet.setSizePolicy(qsp)
self.applet.setLayout(self.layout)
I'm not quite sure if that's the way I should be doing it because
whenever I set the size policy to anything different than the default
it affects the whole panel the applet goes in. I mean, everything
inside the panel grows beyond the size of the panel just like this
[1]. Using any other policy the icons are again small with gaps in
between, like this [2].
I tried reimplementing the sizeHint method but it never gets called
and I quite dont know what to do there.
[1] http://media.kumomi.es/linux/panel_big.png
[2] http://media.kumomi.es/linux/panel_small.png
More information about the Plasma-devel
mailing list