Hello. I am trying to add a QPushButton dynamically.
pushButton->setObjectName(QStringLiteral("pushButton"));
pushButton
->setGeometry
(QRect(60,
140,
75,
23));
m_pCogSparkzEditorClass->layout()->addWidget(pushButton);
QPushButton* pushButton = new QPushButton(m_pUI->dockSelectionView);
pushButton->setObjectName(QStringLiteral("pushButton"));
pushButton->setGeometry(QRect(60, 140, 75, 23));
m_pCogSparkzEditorClass->layout()->addWidget(pushButton);
To copy to clipboard, switch view to plain text mode
This adds a button, but not to the dock widget.
If I add a QPushButton in the designer, when I change the size of the docked widget the button moves accordingly.
But when I try to add it in code, passing the parent in the constructor - it behaves as if I just added it to the QMainWindow and not to the dock widget.
So my questions is: How do I add a QWidget to a QDockWidget?
Many thanks, Jack.
Bookmarks