Hello all,
I created a gui for my application like those of qtcreator where a QToolBar is placed on left side with several push button that switch app's central widget. Now i'd like to add another QToolBar placed just on right of the first one to create a submenu. I wrote this little snippet of code to show how QToolBar looks like:
{
Q_OBJECT
public:
void createActions();
private:
};
MainWindow
::MainWindow(QWidget *parent
){
createActions();
tb->setFloatable(false);
tb->setMovable(false);
addToolBar(Qt::LeftToolBarArea,tb);
tb->setAllowedAreas(Qt::LeftToolBarArea);
tb->setOrientation(Qt::Horizontal);
tb->addAction(quitAction);
tab->setFloatable(false);
tab->setMovable(false);
tab->setAllowedAreas(Qt::LeftToolBarArea);
tab->setOrientation(Qt::Horizontal);
addToolBar(Qt::LeftToolBarArea,tab);
tab->addAction(quitAction);
}
class MainWindow: public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent=0);
void createActions();
private:
QToolBar *tb;
QToolBar *tab;
QAction *quitAction;
};
MainWindow::MainWindow(QWidget *parent)
{
createActions();
tb = new QToolBar();
tb->setFloatable(false);
tb->setMovable(false);
addToolBar(Qt::LeftToolBarArea,tb);
tb->setAllowedAreas(Qt::LeftToolBarArea);
tb->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
tb->setOrientation(Qt::Horizontal);
tb->addAction(quitAction);
tab = new QToolBar();
tab->setFloatable(false);
tab->setMovable(false);
tab->setAllowedAreas(Qt::LeftToolBarArea);
tab->setOrientation(Qt::Horizontal);
tab->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
addToolBar(Qt::LeftToolBarArea,tab);
tab->addAction(quitAction);
}
To copy to clipboard, switch view to plain text mode
but QToolBar are below the other instead of one near the other. Is it possible to achive what i need, with QToolBar, and how?
I added a screenshot to show how i'd like the effect looks like.
t.jpg
Thanks for any advice.
Al
Bookmarks