widget not resized within QDockWidget
I added a new QDockWidget as all the other ones I already have. However this time the Widget is not resized within the QDockWidget, as if it had not layout.
It is created with this code:
Code:
dockAppMessages->setAllowedAreas(Qt::BottomDockWidgetArea | Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea);
widgetDockErrorMessageImpl = new widgetDockErrorMessage(dockAppMessages);
dockAppMessages->setWidget(widgetDockPhaseShapesImpl);
dockAppMessages->setWindowTitle("Application Messages");
addDockWidget(Qt::BottomDockWidgetArea , dockAppMessages);
menuView->addAction(dockAppMessages->toggleViewAction());
widgetDockErrorMessage, the widget displayed within QDockWidget has a Layout, set to Expanding.
The ui file is the following
Code:
void setupUi
(QWidget *widgetDockErrorMessage
) {
if (widgetDockErrorMessage->objectName().isEmpty())
widgetDockErrorMessage
->setObjectName
(QString::fromUtf8("widgetDockErrorMessage"));
widgetDockErrorMessage->resize(499, 153);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(widgetDockErrorMessage->sizePolicy().hasHeightForWidth());
widgetDockErrorMessage->setSizePolicy(sizePolicy);
gridLayout
->setObjectName
(QString::fromUtf8("gridLayout"));
ErrorList = new WidgetListStringStack(widgetDockErrorMessage);
ErrorList
->setObjectName
(QString::fromUtf8("ErrorList"));
sizePolicy.setHeightForWidth(ErrorList->sizePolicy().hasHeightForWidth());
ErrorList->setSizePolicy(sizePolicy);
gridLayout->addWidget(ErrorList, 0, 0, 1, 1);
horizontalLayout
->setObjectName
(QString::fromUtf8("horizontalLayout"));
horizontalLayout->addItem(horizontalSpacer);
pushButtonClearList
= new QPushButton(widgetDockErrorMessage
);
pushButtonClearList
->setObjectName
(QString::fromUtf8("pushButtonClearList"));
horizontalLayout->addWidget(pushButtonClearList);
gridLayout->addLayout(horizontalLayout, 1, 0, 1, 1);
retranslateUi(widgetDockErrorMessage);
QMetaObject::connectSlotsByName(widgetDockErrorMessage
);
} // setupUi
Any ideas?
Matthias
Re: widget not resized within QDockWidget
Quote:
Originally Posted by
pospiech
Code:
widgetDockErrorMessageImpl = new widgetDockErrorMessage(dockAppMessages);
dockAppMessages->setWidget(widgetDockPhaseShapesImpl);
The correct version of the above code is
Code:
widgetDockErrorMessageImpl = new widgetDockErrorMessage(dockAppMessages);
dockAppMessages->setWidget(widgetDockErrorMessageImpl);
which makes the problem disappear...
Re: widget not resized within QDockWidget
Using a little bit more distinct variable names would've made the error visible. I still had to stare a few seconds the see what's the actual difference in your solution... :)