More problems with QDockWidgets
-
I've re-structured my code so that I only have the one QMainWindow. This should have resolved the problems I reported against 6.4.0 with Dock Windows that Axel said were my fault!
Unfortunately:
I have a DockWidget that I want to place on the left and occupy both the top left and bottom left corners, and another that I want at either the bottom or right dock areas.
// // Set the Docking Area Corner Configuration so that the // Explorer Bar takes the full left side docking area // setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); explorerBar = new ExplorerBar(this); addDockWidget(Qt::LeftDockWidgetArea, explorerBar); pictureList = new DSS::PictureList(this); addDockWidget(Qt::BottomDockWidgetArea, pictureList);Problems:
-
The explorerBar control in the left dock area is expanded horizontally even though I don't believe it should be.
-
The pictureList which should occupy the central and right bottom dock areas is using the entire bottom dock area, even though I had reserved the bottom left corner for the left dock area.
-
If I undock the pictureList, I cannot dock it on the right dock area (oh dear this sounds familiar).

Here's the ui header for the explorer bar in case I made an error which resulted in it expanding horizontally:
/******************************************************************************** ** Form generated from reading UI file 'ExplorerBar.ui' ** ** Created by: Qt User Interface Compiler version 6.4.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_EXPLORERBAR_H #define UI_EXPLORERBAR_H #include <QtCore/QVariant> #include <QtWidgets/QApplication> #include <QtWidgets/QDockWidget> #include <QtWidgets/QFrame> #include <QtWidgets/QGroupBox> #include <QtWidgets/QLabel> #include <QtWidgets/QScrollArea> #include <QtWidgets/QSpacerItem> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_ExplorerBar { public: QWidget *dockWidgetContents; QVBoxLayout *verticalLayout; QScrollArea *scrollArea; QWidget *scrollAreaWidgetContents; QVBoxLayout *verticalLayout_2; QGroupBox *registerAndStack; QVBoxLayout *verticalLayout_8; QFrame *frame_1; QVBoxLayout *verticalLayout_9; QLabel *openLights; QLabel *openDarks; QLabel *openFlats; QLabel *openDarkFlats; QLabel *openBias; QSpacerItem *verticalSpacer_3; QLabel *openFilelist; QLabel *saveFilelist; QSpacerItem *verticalSpacer_4; QLabel *clearList; QFrame *frame_2; QVBoxLayout *verticalLayout_10; QLabel *checkAll; QLabel *checkAbove; QLabel *unCheckAll; QFrame *frame_3; QVBoxLayout *verticalLayout_11; QLabel *registerChecked; QLabel *computeOffsets; QLabel *stackChecked; QLabel *batchStacking; QGroupBox *processing; QVBoxLayout *verticalLayout_5; QLabel *openPicture; QLabel *copyPicture; QLabel *doStarMask; QLabel *savePicture; QGroupBox *options; QVBoxLayout *verticalLayout_4; QLabel *settings; QLabel *ddpSettings; QLabel *loadSettings; QLabel *saveSettings; QLabel *recommendedSettings; QSpacerItem *verticalSpacer_2; QLabel *about; QSpacerItem *verticalSpacer_5; QLabel *help; QSpacerItem *verticalSpacer; void setupUi(QDockWidget *ExplorerBar) { if (ExplorerBar->objectName().isEmpty()) ExplorerBar->setObjectName("ExplorerBar"); ExplorerBar->resize(275, 763); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(ExplorerBar->sizePolicy().hasHeightForWidth()); ExplorerBar->setSizePolicy(sizePolicy); ExplorerBar->setMinimumSize(QSize(260, 454)); ExplorerBar->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable); ExplorerBar->setAllowedAreas(Qt::LeftDockWidgetArea); ExplorerBar->setWindowTitle(QString::fromUtf8("DeepSkyStacker")); dockWidgetContents = new QWidget(); dockWidgetContents->setObjectName("dockWidgetContents"); sizePolicy.setHeightForWidth(dockWidgetContents->sizePolicy().hasHeightForWidth()); dockWidgetContents->setSizePolicy(sizePolicy); dockWidgetContents->setMinimumSize(QSize(260, 430)); verticalLayout = new QVBoxLayout(dockWidgetContents); verticalLayout->setSpacing(24); verticalLayout->setObjectName("verticalLayout"); verticalLayout->setContentsMargins(5, 5, 5, 5); scrollArea = new QScrollArea(dockWidgetContents); scrollArea->setObjectName("scrollArea"); sizePolicy.setHeightForWidth(scrollArea->sizePolicy().hasHeightForWidth()); scrollArea->setSizePolicy(sizePolicy); scrollArea->setWidgetResizable(true); scrollAreaWidgetContents = new QWidget(); scrollAreaWidgetContents->setObjectName("scrollAreaWidgetContents"); scrollAreaWidgetContents->setGeometry(QRect(0, 0, 263, 727)); scrollAreaWidgetContents->setMinimumSize(QSize(230, 700)); verticalLayout_2 = new QVBoxLayout(scrollAreaWidgetContents); verticalLayout_2->setObjectName("verticalLayout_2"); registerAndStack = new QGroupBox(scrollAreaWidgetContents); registerAndStack->setObjectName("registerAndStack"); QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Fixed); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(registerAndStack->sizePolicy().hasHeightForWidth()); registerAndStack->setSizePolicy(sizePolicy1); registerAndStack->setStyleSheet(QString::fromUtf8("background-color: lightcyan")); verticalLayout_8 = new QVBoxLayout(registerAndStack); verticalLayout_8->setSpacing(5); verticalLayout_8->setObjectName("verticalLayout_8"); verticalLayout_8->setContentsMargins(5, 5, 5, 5); frame_1 = new QFrame(registerAndStack); frame_1->setObjectName("frame_1"); sizePolicy1.setHeightForWidth(frame_1->sizePolicy().hasHeightForWidth()); frame_1->setSizePolicy(sizePolicy1); frame_1->setFrameShape(QFrame::StyledPanel); verticalLayout_9 = new QVBoxLayout(frame_1); verticalLayout_9->setSpacing(4); verticalLayout_9->setObjectName("verticalLayout_9"); verticalLayout_9->setContentsMargins(5, 5, 5, 5); openLights = new QLabel(frame_1); openLights->setObjectName("openLights"); openLights->setStyleSheet(QString::fromUtf8("")); verticalLayout_9->addWidget(openLights); openDarks = new QLabel(frame_1); openDarks->setObjectName("openDarks"); openDarks->setStyleSheet(QString::fromUtf8("margin-left: 30")); openDarks->setMargin(0); verticalLayout_9->addWidget(openDarks); openFlats = new QLabel(frame_1); openFlats->setObjectName("openFlats"); openFlats->setStyleSheet(QString::fromUtf8("margin-left: 30")); verticalLayout_9->addWidget(openFlats); openDarkFlats = new QLabel(frame_1); openDarkFlats->setObjectName("openDarkFlats"); openDarkFlats->setStyleSheet(QString::fromUtf8("margin-left: 30")); verticalLayout_9->addWidget(openDarkFlats); openBias = new QLabel(frame_1); openBias->setObjectName("openBias"); openBias->setStyleSheet(QString::fromUtf8("margin-left: 30")); verticalLayout_9->addWidget(openBias); verticalSpacer_3 = new QSpacerItem(20, 5, QSizePolicy::Minimum, QSizePolicy::Fixed); verticalLayout_9->addItem(verticalSpacer_3); openFilelist = new QLabel(frame_1); openFilelist->setObjectName("openFilelist"); verticalLayout_9->addWidget(openFilelist); saveFilelist = new QLabel(frame_1); saveFilelist->setObjectName("saveFilelist"); verticalLayout_9->addWidget(saveFilelist); verticalSpacer_4 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed); verticalLayout_9->addItem(verticalSpacer_4); clearList = new QLabel(frame_1); clearList->setObjectName("clearList"); verticalLayout_9->addWidget(clearList); verticalLayout_8->addWidget(frame_1); frame_2 = new QFrame(registerAndStack); frame_2->setObjectName("frame_2"); sizePolicy1.setHeightForWidth(frame_2->sizePolicy().hasHeightForWidth()); frame_2->setSizePolicy(sizePolicy1); frame_2->setFrameShape(QFrame::StyledPanel); verticalLayout_10 = new QVBoxLayout(frame_2); verticalLayout_10->setSpacing(4); verticalLayout_10->setObjectName("verticalLayout_10"); verticalLayout_10->setContentsMargins(5, 5, 5, 5); checkAll = new QLabel(frame_2); checkAll->setObjectName("checkAll"); verticalLayout_10->addWidget(checkAll); checkAbove = new QLabel(frame_2); checkAbove->setObjectName("checkAbove"); verticalLayout_10->addWidget(checkAbove); unCheckAll = new QLabel(frame_2); unCheckAll->setObjectName("unCheckAll"); verticalLayout_10->addWidget(unCheckAll); verticalLayout_8->addWidget(frame_2); frame_3 = new QFrame(registerAndStack); frame_3->setObjectName("frame_3"); sizePolicy1.setHeightForWidth(frame_3->sizePolicy().hasHeightForWidth()); frame_3->setSizePolicy(sizePolicy1); frame_3->setFrameShape(QFrame::StyledPanel); verticalLayout_11 = new QVBoxLayout(frame_3); verticalLayout_11->setSpacing(4); verticalLayout_11->setObjectName("verticalLayout_11"); verticalLayout_11->setContentsMargins(5, 5, 5, 5); registerChecked = new QLabel(frame_3); registerChecked->setObjectName("registerChecked"); verticalLayout_11->addWidget(registerChecked); computeOffsets = new QLabel(frame_3); computeOffsets->setObjectName("computeOffsets"); verticalLayout_11->addWidget(computeOffsets); stackChecked = new QLabel(frame_3); stackChecked->setObjectName("stackChecked"); verticalLayout_11->addWidget(stackChecked); batchStacking = new QLabel(frame_3); batchStacking->setObjectName("batchStacking"); verticalLayout_11->addWidget(batchStacking); verticalLayout_8->addWidget(frame_3); verticalLayout_8->setStretch(0, 7); verticalLayout_8->setStretch(1, 3); verticalLayout_8->setStretch(2, 4); verticalLayout_2->addWidget(registerAndStack); processing = new QGroupBox(scrollAreaWidgetContents); processing->setObjectName("processing"); sizePolicy1.setHeightForWidth(processing->sizePolicy().hasHeightForWidth()); processing->setSizePolicy(sizePolicy1); processing->setStyleSheet(QString::fromUtf8("background-color: rgb(240, 240, 240)")); verticalLayout_5 = new QVBoxLayout(processing); verticalLayout_5->setSpacing(4); verticalLayout_5->setObjectName("verticalLayout_5"); verticalLayout_5->setContentsMargins(11, 6, 11, 6); openPicture = new QLabel(processing); openPicture->setObjectName("openPicture"); verticalLayout_5->addWidget(openPicture); copyPicture = new QLabel(processing); copyPicture->setObjectName("copyPicture"); verticalLayout_5->addWidget(copyPicture); doStarMask = new QLabel(processing); doStarMask->setObjectName("doStarMask"); verticalLayout_5->addWidget(doStarMask); savePicture = new QLabel(processing); savePicture->setObjectName("savePicture"); verticalLayout_5->addWidget(savePicture); verticalLayout_2->addWidget(processing); options = new QGroupBox(scrollAreaWidgetContents); options->setObjectName("options"); sizePolicy1.setHeightForWidth(options->sizePolicy().hasHeightForWidth()); options->setSizePolicy(sizePolicy1); options->setStyleSheet(QString::fromUtf8("background-color: lightcyan")); verticalLayout_4 = new QVBoxLayout(options); verticalLayout_4->setSpacing(4); verticalLayout_4->setObjectName("verticalLayout_4"); verticalLayout_4->setContentsMargins(11, 6, 11, 6); settings = new QLabel(options); settings->setObjectName("settings"); verticalLayout_4->addWidget(settings); ddpSettings = new QLabel(options); ddpSettings->setObjectName("ddpSettings"); ddpSettings->setStyleSheet(QString::fromUtf8("margin-left: 30")); verticalLayout_4->addWidget(ddpSettings); loadSettings = new QLabel(options); loadSettings->setObjectName("loadSettings"); loadSettings->setStyleSheet(QString::fromUtf8("margin-left: 30")); verticalLayout_4->addWidget(loadSettings); saveSettings = new QLabel(options); saveSettings->setObjectName("saveSettings"); saveSettings->setStyleSheet(QString::fromUtf8("margin-left: 30")); verticalLayout_4->addWidget(saveSettings); recommendedSettings = new QLabel(options); recommendedSettings->setObjectName("recommendedSettings"); recommendedSettings->setStyleSheet(QString::fromUtf8("margin-left: 30")); verticalLayout_4->addWidget(recommendedSettings); verticalSpacer_2 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout_4->addItem(verticalSpacer_2); about = new QLabel(options); about->setObjectName("about"); verticalLayout_4->addWidget(about); verticalSpacer_5 = new QSpacerItem(20, 5, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout_4->addItem(verticalSpacer_5); help = new QLabel(options); help->setObjectName("help"); verticalLayout_4->addWidget(help); verticalLayout_2->addWidget(options); verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout_2->addItem(verticalSpacer); scrollArea->setWidget(scrollAreaWidgetContents); verticalLayout->addWidget(scrollArea); ExplorerBar->setWidget(dockWidgetContents); retranslateUi(ExplorerBar); QObject::connect(openLights, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onOpenLights())); QObject::connect(openDarks, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onOpenDarks())); QObject::connect(openFlats, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onOpenFlats())); QObject::connect(openDarkFlats, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onOpenDarkFlats())); QObject::connect(openBias, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onOpenBias())); QObject::connect(openFilelist, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onOpenFilelist())); QObject::connect(saveFilelist, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onSaveFilelist())); QObject::connect(clearList, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onClearList())); QObject::connect(checkAll, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onCheckAll())); QObject::connect(checkAbove, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onCheckAbove())); QObject::connect(unCheckAll, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onUncheckAll())); QObject::connect(registerChecked, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onRegisterChecked())); QObject::connect(computeOffsets, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onComputeOffsets())); QObject::connect(stackChecked, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onStackChecked())); QObject::connect(batchStacking, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onBatchStacking())); QObject::connect(openPicture, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onOpenPicture())); QObject::connect(copyPicture, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onCopyPicture())); QObject::connect(doStarMask, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onDoStarMask())); QObject::connect(savePicture, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onSavePicture())); QObject::connect(settings, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onSettings())); QObject::connect(ddpSettings, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onDDPSettings())); QObject::connect(loadSettings, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onLoadSettings())); QObject::connect(saveSettings, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onSaveSettings())); QObject::connect(recommendedSettings, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onRecommendedSettings())); QObject::connect(about, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onAbout())); QObject::connect(help, SIGNAL(linkActivated(QString)), ExplorerBar, SLOT(onHelp())); QMetaObject::connectSlotsByName(ExplorerBar); } // setupUi void retranslateUi(QDockWidget *ExplorerBar) { ExplorerBar->setStyleSheet(QString()); dockWidgetContents->setWindowTitle(QString()); registerAndStack->setTitle(QCoreApplication::translate("ExplorerBar", "Registering and Stacking", "IDC_STACKING_TITLE")); openLights->setText(QCoreApplication::translate("ExplorerBar", "Open picture files...", "IDC_STACKING_OPENFILES")); openDarks->setText(QCoreApplication::translate("ExplorerBar", "dark files...", "IDC_STACKING_OPENDARKS")); openFlats->setText(QCoreApplication::translate("ExplorerBar", "flat files...", "IDC_STACKING_OPENFLATS")); openDarkFlats->setText(QCoreApplication::translate("ExplorerBar", "dark flat files...", "IDC_STACKING_OPENDARKFLATS")); openBias->setText(QCoreApplication::translate("ExplorerBar", "offset/bias files...", "IDC_STACKING_OPENOFFSETS")); openFilelist->setText(QCoreApplication::translate("ExplorerBar", "Open a File List...", "IDC_STACKING_LOADLIST")); saveFilelist->setText(QCoreApplication::translate("ExplorerBar", "Save the File List...", "IDC_STACKING_SAVELIST")); clearList->setText(QCoreApplication::translate("ExplorerBar", "Clear List", "IDC_STACKING_CLEARLIST")); checkAll->setText(QCoreApplication::translate("ExplorerBar", "Check all", "IDC_STACKING_CHECKALL")); checkAbove->setText(QCoreApplication::translate("ExplorerBar", "Check above a threshold...", "IDC_STACKING_CHECKABOVE")); unCheckAll->setText(QCoreApplication::translate("ExplorerBar", "Uncheck all", "IDC_STACKING_UNCHECKALL")); registerChecked->setText(QCoreApplication::translate("ExplorerBar", "Register checked pictures...", "IDC_REGISTERING_REGISTERCHECKED")); computeOffsets->setText(QCoreApplication::translate("ExplorerBar", "Compute offsets...", "IDC_STACKING_COMPUTEOFFSETS")); stackChecked->setText(QCoreApplication::translate("ExplorerBar", "Stack checked pictures...", "IDC_STACKING_STACKCHECKED")); batchStacking->setText(QCoreApplication::translate("ExplorerBar", "Batch stacking...", "IDC_STACKING_BATCHSTACK")); processing->setTitle(QCoreApplication::translate("ExplorerBar", "Processing", "IDC_PROCESSING_TITLE")); openPicture->setText(QCoreApplication::translate("ExplorerBar", "Open picture file...", "IDC_PROCESSING_OPENFILE")); copyPicture->setText(QCoreApplication::translate("ExplorerBar", "Copy current picture to clipboard", "IDC_PROCESSING_COPYTOCLIPBOARD")); doStarMask->setText(QCoreApplication::translate("ExplorerBar", "Create a Star Mask...", "IDC_PROCESSING_CREATESTARMASK")); savePicture->setText(QCoreApplication::translate("ExplorerBar", "Save picture to file...", "IDC_PROCESSING_SAVEFILE")); options->setTitle(QCoreApplication::translate("ExplorerBar", "Options", "IDC_OPTIONS_TITLE")); settings->setText(QCoreApplication::translate("ExplorerBar", "Settings...", "IDC_OPTIONS_SETTINGS")); ddpSettings->setText(QCoreApplication::translate("ExplorerBar", "Raw/FITS DDP Settings...", "IDC_OPTIONS_RAWDDPSETTINGS")); loadSettings->setText(QCoreApplication::translate("ExplorerBar", "Load...", "IDC_OPTIONS_LOADSETTINGS")); saveSettings->setText(QCoreApplication::translate("ExplorerBar", "Save...", "IDC_OPTIONS_SAVESETTINGS")); recommendedSettings->setText(QCoreApplication::translate("ExplorerBar", "Recommended...", "IDC_OPTIONS_RECOMMANDEDSETTINGS")); about->setText(QCoreApplication::translate("ExplorerBar", "About DeepSkyStacker...", "IDC_ABOUT")); help->setText(QCoreApplication::translate("ExplorerBar", "DeepSkyStacker's Help...", "IDC_CONTEXTHELP")); } // retranslateUi }; namespace Ui { class ExplorerBar: public Ui_ExplorerBar {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_EXPLORERBAR_H -
-
Aha! The problem with the layout is located!
QSettings settings;
settings.beginGroup("MainWindow");
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
settings.endGroup();The saved geometry and window state were wrong for the new code structure! I deleted the old entries in the registry, and that resolved the layout problems:

Unfortunately the pictureList still won't dock on the right hand side :(
For the avoidance of doubt here's the ui header for the Picture List:
/******************************************************************************** ** Form generated from reading UI file 'PictureList.ui' ** ** Created by: Qt User Interface Compiler version 6.4.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_PICTURELIST_H #define UI_PICTURELIST_H #include <QtCore/QVariant> #include <QtWidgets/QApplication> #include <QtWidgets/QDockWidget> #include <QtWidgets/QHeaderView> #include <QtWidgets/QTabBar> #include <QtWidgets/QTableView> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_PictureList { public: QWidget *dockWidgetContents; QVBoxLayout *verticalLayout_2; QTableView *tableView; QTabBar *tabBar; void setupUi(QDockWidget *PictureList) { if (PictureList->objectName().isEmpty()) PictureList->setObjectName("PictureList"); PictureList->resize(618, 255); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(PictureList->sizePolicy().hasHeightForWidth()); PictureList->setSizePolicy(sizePolicy); PictureList->setMinimumSize(QSize(618, 253)); PictureList->setStyleSheet(QString::fromUtf8("")); PictureList->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable); PictureList->setAllowedAreas(Qt::BottomDockWidgetArea|Qt::RightDockWidgetArea); PictureList->setWindowTitle(QString::fromUtf8("Light Frames: 0 - Dark Frames: 0 - Flat Frames: 0 - Dark Flat Frames: 0 - Offset/Bias Frames: 0")); dockWidgetContents = new QWidget(); dockWidgetContents->setObjectName("dockWidgetContents"); QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(dockWidgetContents->sizePolicy().hasHeightForWidth()); dockWidgetContents->setSizePolicy(sizePolicy1); verticalLayout_2 = new QVBoxLayout(dockWidgetContents); verticalLayout_2->setSpacing(0); verticalLayout_2->setObjectName("verticalLayout_2"); verticalLayout_2->setContentsMargins(-1, -1, -1, 2); tableView = new QTableView(dockWidgetContents); tableView->setObjectName("tableView"); tableView->setMinimumSize(QSize(600, 175)); tableView->setSelectionMode(QAbstractItemView::ExtendedSelection); tableView->setSelectionBehavior(QAbstractItemView::SelectRows); tableView->setSortingEnabled(true); tableView->verticalHeader()->setVisible(false); verticalLayout_2->addWidget(tableView); tabBar = new QTabBar(dockWidgetContents); tabBar->setObjectName("tabBar"); QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Minimum); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(tabBar->sizePolicy().hasHeightForWidth()); tabBar->setSizePolicy(sizePolicy2); tabBar->setMinimumSize(QSize(0, 28)); tabBar->setMaximumSize(QSize(16777215, 28)); verticalLayout_2->addWidget(tabBar); PictureList->setWidget(dockWidgetContents); retranslateUi(PictureList); QMetaObject::connectSlotsByName(PictureList); } // setupUi void retranslateUi(QDockWidget *PictureList) { (void)PictureList; } // retranslateUi }; namespace Ui { class PictureList: public Ui_PictureList {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_PICTURELIST_HD.
-
The code you posted results in something like this for me, so I don't know what you're doing, but it has to be something in the code you didn't show.
-
@Perdrix Same here, but it's inside the window, so it shouldn't matter. OS cares about the window and the frame. What's inside is controlled by Qt.
-
Then I am baffled, as here's all the code that I believe to be relevant:
void DeepSkyStacker::onInitialise() { ZFUNCTRACE_RUNTIME(); // // Set the Docking Area Corner Configuration so that the // Explorer Bar takes the full left side docking area // setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); ZTRACE_RUNTIME("Creating Explorer Bar (Left Panel)"); explorerBar = new ExplorerBar(this); addDockWidget(Qt::LeftDockWidgetArea, explorerBar); ZTRACE_RUNTIME("Creating pictureList"); pictureList = new DSS::PictureList(this); addDockWidget(Qt::BottomDockWidgetArea, pictureList); ZTRACE_RUNTIME("Creating stackedWidget"); stackedWidget = new QStackedWidget(this); stackedWidget->setObjectName("stackedWidget"); setCentralWidget(stackedWidget); ZTRACE_RUNTIME("Creating Stacking Panel"); stackingDlg = new DSS::StackingDlg(this, pictureList); stackingDlg->setObjectName("stackingDlg"); ZTRACE_RUNTIME("Adding Stacking Panel to stackedWidget"); stackedWidget->addWidget(stackingDlg); winHost = new QWinHost(stackedWidget); winHost->setObjectName("winHost"); stackedWidget->addWidget(winHost); ZTRACE_RUNTIME("Creating Processing Panel"); BOOL result = processingDlg.Create(IDD_PROCESSING); if (FALSE == result) { int lastErr = GetLastError(); ZTRACE_RUNTIME("lastErr = %d", lastErr); } HWND hwnd{ processingDlg.GetSafeHwnd() }; Q_ASSERT(NULL != hwnd); winHost->setWindow(hwnd); stackedWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); winHost->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); -
Aha! The problem with the layout is located!
QSettings settings;
settings.beginGroup("MainWindow");
restoreGeometry(settings.value("geometry").toByteArray());
restoreState(settings.value("windowState").toByteArray());
settings.endGroup();The saved geometry and window state were wrong for the new code structure! I deleted the old entries in the registry, and that resolved the layout problems:

Unfortunately the pictureList still won't dock on the right hand side :(
For the avoidance of doubt here's the ui header for the Picture List:
/******************************************************************************** ** Form generated from reading UI file 'PictureList.ui' ** ** Created by: Qt User Interface Compiler version 6.4.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_PICTURELIST_H #define UI_PICTURELIST_H #include <QtCore/QVariant> #include <QtWidgets/QApplication> #include <QtWidgets/QDockWidget> #include <QtWidgets/QHeaderView> #include <QtWidgets/QTabBar> #include <QtWidgets/QTableView> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_PictureList { public: QWidget *dockWidgetContents; QVBoxLayout *verticalLayout_2; QTableView *tableView; QTabBar *tabBar; void setupUi(QDockWidget *PictureList) { if (PictureList->objectName().isEmpty()) PictureList->setObjectName("PictureList"); PictureList->resize(618, 255); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(PictureList->sizePolicy().hasHeightForWidth()); PictureList->setSizePolicy(sizePolicy); PictureList->setMinimumSize(QSize(618, 253)); PictureList->setStyleSheet(QString::fromUtf8("")); PictureList->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable); PictureList->setAllowedAreas(Qt::BottomDockWidgetArea|Qt::RightDockWidgetArea); PictureList->setWindowTitle(QString::fromUtf8("Light Frames: 0 - Dark Frames: 0 - Flat Frames: 0 - Dark Flat Frames: 0 - Offset/Bias Frames: 0")); dockWidgetContents = new QWidget(); dockWidgetContents->setObjectName("dockWidgetContents"); QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Expanding); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(dockWidgetContents->sizePolicy().hasHeightForWidth()); dockWidgetContents->setSizePolicy(sizePolicy1); verticalLayout_2 = new QVBoxLayout(dockWidgetContents); verticalLayout_2->setSpacing(0); verticalLayout_2->setObjectName("verticalLayout_2"); verticalLayout_2->setContentsMargins(-1, -1, -1, 2); tableView = new QTableView(dockWidgetContents); tableView->setObjectName("tableView"); tableView->setMinimumSize(QSize(600, 175)); tableView->setSelectionMode(QAbstractItemView::ExtendedSelection); tableView->setSelectionBehavior(QAbstractItemView::SelectRows); tableView->setSortingEnabled(true); tableView->verticalHeader()->setVisible(false); verticalLayout_2->addWidget(tableView); tabBar = new QTabBar(dockWidgetContents); tabBar->setObjectName("tabBar"); QSizePolicy sizePolicy2(QSizePolicy::Expanding, QSizePolicy::Minimum); sizePolicy2.setHorizontalStretch(0); sizePolicy2.setVerticalStretch(0); sizePolicy2.setHeightForWidth(tabBar->sizePolicy().hasHeightForWidth()); tabBar->setSizePolicy(sizePolicy2); tabBar->setMinimumSize(QSize(0, 28)); tabBar->setMaximumSize(QSize(16777215, 28)); verticalLayout_2->addWidget(tabBar); PictureList->setWidget(dockWidgetContents); retranslateUi(PictureList); QMetaObject::connectSlotsByName(PictureList); } // setupUi void retranslateUi(QDockWidget *PictureList) { (void)PictureList; } // retranslateUi }; namespace Ui { class PictureList: public Ui_PictureList {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_PICTURELIST_HD.
-
Hi,
Do you mean it won't dock when you move it by hand ?
On a side note, when you have save/restore geometry implemented in an application, it's a good idea to have a "factory reset" option that allows to restore to a sane default state for the case you experienced earlier.