Trying to put QToolBar one under the other , but it keeps to be side by side.
-
Hello
i trying to do some thing simple , and put QToolBar one under the other
but it keeps to be side by side . i want them to permnet in the button of the QMainWwindow.
this is the code generated from the Qt Designer:
@class Ui_MainWindow
{
public:
QWidget *centralwidget;
QMenuBar *menubar;
QStatusBar *statusbar;
QToolBar *toolBar;
QToolBar *toolBar_2;void setupUi(QMainWindow *MainWindow) { if (MainWindow->objectName().isEmpty()) MainWindow->setObjectName(QString::fromUtf8("MainWindow")); MainWindow->resize(676, 579); centralwidget = new QWidget(MainWindow); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); MainWindow->setCentralWidget(centralwidget); menubar = new QMenuBar(MainWindow); menubar->setObjectName(QString::fromUtf8("menubar")); menubar->setGeometry(QRect(0, 0, 676, 26)); MainWindow->setMenuBar(menubar); statusbar = new QStatusBar(MainWindow); statusbar->setObjectName(QString::fromUtf8("statusbar")); MainWindow->setStatusBar(statusbar); toolBar = new QToolBar(MainWindow); toolBar->setObjectName(QString::fromUtf8("toolBar")); toolBar->setStyleSheet(QString::fromUtf8("background-color: rgb(0, 255, 255);")); toolBar->setMovable(false); toolBar->setAllowedAreas(Qt::BottomToolBarArea); MainWindow->addToolBar(Qt::BottomToolBarArea, toolBar); MainWindow->insertToolBarBreak(toolBar); toolBar_2 = new QToolBar(MainWindow); toolBar_2->setObjectName(QString::fromUtf8("toolBar_2")); toolBar_2->setStyleSheet(QString::fromUtf8("background-color: rgb(255, 0, 0);")); toolBar_2->setMovable(false); toolBar_2->setAllowedAreas(Qt::BottomToolBarArea); MainWindow->addToolBar(Qt::BottomToolBarArea, toolBar_2); retranslateUi(MainWindow); QMetaObject::connectSlotsByName(MainWindow); } // setupUi void retranslateUi(QMainWindow *MainWindow) { MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); toolBar->setWindowTitle(QApplication::translate("MainWindow", "toolBar", 0, QApplication::UnicodeUTF8)); toolBar_2->setWindowTitle(QApplication::translate("MainWindow", "toolBar_2", 0, QApplication::UnicodeUTF8)); } // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
}
@ -
Hi there,
Maybe read about the QDesigner and the way it uses horizontal and vertical layout options.
There are no layout widgets in your MainWindow to be seen in code, so try it in the QDesigner.