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

positioning in javascript-Plasmoids

Tags: None
(comma "," separated)
User avatar
Anton
KDE Developer
Posts
265
Karma
0
OS

positioning in javascript-Plasmoids

Sun Mar 21, 2010 9:56 am
Hi,
I've been trying to write a plasmoid using the Simplified Javascript API.
Most things work fine, but I couldn't get out how to
1. set an fixed size for an element (I want a tabbar to have an fixed height)
2. position objects undepend from the horizontal/vertical layout (Probably with the GridLayout but I couldn't get out how to use it)

Thanks for the help in advance
User avatar
david_edmundson
KDE Developer
Posts
359
Karma
1
OS
I believe every element has a QRectF property called "geometry", you can set it to any QRect you like.

See http://techbase.kde.org/Development/Tut ... nt_Gallery "Common Properties"
User avatar
Anton
KDE Developer
Posts
265
Karma
0
OS
I tried that but it has no effect...
User avatar
david_edmundson
KDE Developer
Posts
359
Karma
1
OS
Might not change the size (check out size policy stuff), but it should reposition. Make sure the stuff isn't in a layout when using this.

Post a snippit of your code.
User avatar
Anton
KDE Developer
Posts
265
Karma
0
OS
Of course it has to be in a layout, when its not its just absolute.
The question is which layout (linear/grid/anchor) to use that it has relative and flexible positions, but I also can set fixed sizes and (most important) can have elements horizontal and vertical positioned (like a table). (I want to have a button left, a button right, a text-area between and a tabbar under this three)

I thought grid layout seems it offered this features, but I can't get out how to use it
User avatar
david_edmundson
KDE Developer
Posts
359
Karma
1
OS
I think the layout you can do as follows:

VerticalLayout
Horizontal Layout
button text button
tabbar

i.e put the buttons and text box in a horizontal layout
put the horizontal layout in the vertical layout, and then put the tab bar in the vertical layout too.

Qt's grid layout certainly allows an item to span multiple items, but this isn't using Qt's normal layout classes. (they're special ones for graphicsview)
User avatar
Anton
KDE Developer
Posts
265
Karma
0
OS
Thanks this works...
but what should I use as containment for the horizontal-layout?
An empty Label can do but I think it's not best...

and with
element.maximumSize = new QSizeF(width,heigth);
I could resize it correctly

Thanks again for the help

Edit:
Plasmate, Plasmoidviewer and Plasma-Desktop crashed when trying to remove the plasmoid, the crash might be a bug (I've already sent a bug report), but it seems that this was not the preferred way...


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]