This forum has been archived. All content is frozen. Please use KDE Discuss instead.

[SOLVED] Detect plasma applet placement

Tags: None
(comma "," separated)
User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS
How can I get signal or property (something like "bool isOnPanel();"), when my plasma applet moved to panel, instead of desktop?

Last edited by RazrFalcon on Wed Jun 08, 2011 9:56 pm, edited 1 time in total.
pinotree
KDE Developer
Posts
222
Karma
7
OS

Re: Detect plasma applet placement

Wed Jun 08, 2011 8:09 pm
RazrFalcon wrote:How can I get signal or property (something like "bool isOnPanel();"), when my plasma applet moved to panel, instead of desktop?

Reimplement the protected virtual method:

Code: Select all
void constraintsEvent(Plasma::Constraints constraints)

of Plasma::Applet, checking that the "constraints" parameter contain the Plasma::FormFactorConstraint flag; if it does, then the form factor changed, so you can check the new value using formFactor().
See the API documentation of Plasma::Applet and the Plasma namespace.


Pino Toscano
User avatar
RazrFalcon
Registered Member
Posts
23
Karma
0
OS

Re: Detect plasma applet placement

Wed Jun 08, 2011 9:55 pm
Thank you very much. It's works fine.

formFactor() returns "0" when applet are on desktop, and "2" when are on panel.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot]