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

KToolbar position

Tags: None
(comma "," separated)
hayzel
Registered Member
Posts
4
Karma
0
OS

KToolbar position

Tue Oct 27, 2009 12:42 pm
I work on a project that currently I use 3 toolbars in my main window:
The first is the mainToolbar that occupies the upper pos of the window.
And the other two I want them to be placed like this:

http://imagebin.ca/view/MgzOQGH.html

Both on the left side, adjacent to each other vertically.
On my init method i write:
Code: Select all
    m_toolbar1= toolBar("mainToolBar");
    m_toolbar2 = toolBar("itemToolBar");
    m_toolbar3 = toolBar("actionToolBar");
    m_toolbar2->setToolButtonStyle(Qt::ToolButtonIconOnly);
    m_toolbar2->setIconSize(QSize(20,20));
    addToolBar(Qt::LeftToolBarArea,m_toolbar2);
    m_toolbar3->setToolButtonStyle(Qt::ToolButtonIconOnly);
    m_toolbar3->setIconSize(QSize(20,20));
    m_toolbar3->setAllowedAreas(Qt::LeftToolBarArea);
    addToolBar(Qt::LeftToolBarArea,m_toolbar3);

but they are placed like this:

http://imagebin.ca/view/gbCSK46m.html

The second one down from the other.

How can I set them to be like the first screenshot programmatically?

PS. The first screenshot is achieved by moving the third when running the program on the left of the other toolbar, with the mouse.


Thank you in advance.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: KToolbar position

Thu Oct 29, 2009 5:56 am
This is because there is sufficient space remaining for the second toolbar to fit. In order to achieve what you desire, you need to make the first toolbar consume all available space, then it will hopefully do what you wish.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
hayzel
Registered Member
Posts
4
Karma
0
OS

Re: KToolbar position

Thu Oct 29, 2009 9:22 am
No, I don't think this is a solution. If you grow the size of a toolbar tou much, you will end up with two small arrows on it's bottom to scroll it.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: KToolbar position

Fri Oct 30, 2009 3:56 am
You may wish to look at toolbar breaks, which may provide the needed functionality,


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
hayzel
Registered Member
Posts
4
Karma
0
OS

Re: KToolbar position

Fri Oct 30, 2009 7:12 pm
Yes , you are right. I didn't notice the existence of insertToolbarBreak
If I call it on the second m_toolbar , it "breaks" to a second column like the picture above.
Thanks. :p:p:D


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], markhm, rblackwell, sethaaaa, Sogou [Bot], Yahoo [Bot]