On/Off-Switch with QPushButton

Rainer Dorsch ml at bokomoko.de
Sun Nov 1 10:57:54 UTC 2015


Hi Luca,

On Sunday 01 November 2015 11:38:43 Luca Beltrame wrote:
> In data domenica 1 novembre 2015 11:15:21 CET, Rainer Dorsch ha scritto:
> 
> Hello,
> 
> for the record, you're talking about Python plasmoids for Plasma 4.11.x,
> correct?

yes, that is correct.

> 
> > AttributeError: 'PushButton' object has no attribute 'setIconSize'
> > Interesting enough the size issue is then gone...
> 
> Is setIconSize actually a method of push buttons? 

I found it here

http://doc.qt.io/qt-5/qabstractbutton.html#iconSize-prop

> Also, just for a question,
> why using QPushButtons? They will not follow the Plasma theme and colors
> for anyone using the plasmoid.

Hmmm.... I started of an example, which was close to what I was looking for. 
Actually it was exactly what I was looking for, but then I found limitations 
and started to modify the code...

What would work better? 

> Also, I would suggest to avoid triggering exceptions in Python code that is
> run from Plasma, because the exception may lead to the underlying C++ object
> being deleted, potentially crashing the whole shell.

Oh, yes. The setIconSize() triggers the exception. That is the main reason, 
why I cannot use it.

Many thanks
Rainer

-- 
Rainer Dorsch
http://bokomoko.de/


More information about the Plasma-devel mailing list