parisiasl
11th March 2010, 18:06
Hi,
I've a QToolBar with 30 Actions : one column of 30 Icons.
I want organize this Actions in 2 Colums of 15 items for column.
I think to create a Vertical Layout, and insert in this Layout 15 Horizontal Layouts.
Then in every Horizontal Layouts add two QActions.
But the layout with the QActions in the QToolBar don't works :
I Post a little example, with only one icon (QAction) :
1. I Create a Widget (w1) with only a QAction.
2. I Create an HorizontalLayout (hl) and i set to it the Widget (w1)
3. I Create a new Widget (w2)
4. I Set to w2 the layout (hl) that contains the other widget (w1).
5. I Add the w2 widget to the toolBar.
QWidget *w1 = new QWidget();
w1->addAction(myAction); // myAction is QAction*;
QHBoxLayout *hl = new QHBoxLayout();
hl->addWidget(w1);
QWidget *w2 = new QWidget();
w2->setLayout(hl);
toolBar->addWidget(w2);
This code don't works. In the Toolbar nothing appears.
How can I manage the layout in the ToolBar ?
Thank you
Salvo
I've a QToolBar with 30 Actions : one column of 30 Icons.
I want organize this Actions in 2 Colums of 15 items for column.
I think to create a Vertical Layout, and insert in this Layout 15 Horizontal Layouts.
Then in every Horizontal Layouts add two QActions.
But the layout with the QActions in the QToolBar don't works :
I Post a little example, with only one icon (QAction) :
1. I Create a Widget (w1) with only a QAction.
2. I Create an HorizontalLayout (hl) and i set to it the Widget (w1)
3. I Create a new Widget (w2)
4. I Set to w2 the layout (hl) that contains the other widget (w1).
5. I Add the w2 widget to the toolBar.
QWidget *w1 = new QWidget();
w1->addAction(myAction); // myAction is QAction*;
QHBoxLayout *hl = new QHBoxLayout();
hl->addWidget(w1);
QWidget *w2 = new QWidget();
w2->setLayout(hl);
toolBar->addWidget(w2);
This code don't works. In the Toolbar nothing appears.
How can I manage the layout in the ToolBar ?
Thank you
Salvo