Well, you have definitively found a bug, thanks!
Setting a style or a palette isn't necessary to reproduce it.
The issue reproduces on openSuSE Tumbleweed with Qt 6.10 just like that:
#include <QApplication>
#include <QMainWindow>
#include <QDockWidget>
#include <QStyleFactory>
#include <QTextEdit>
struct MainWindow : public QMainWindow
{
MainWindow(QWidget *parent = nullptr);
void createDockWidget(const QString &title, Qt::DockWidgetArea area);
};
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
// Set dock options for better behavior
setDockOptions(QMainWindow::AllowTabbedDocks |
QMainWindow::AllowNestedDocks |
QMainWindow::GroupedDragging |
QMainWindow::AnimatedDocks);
// Create dockable panels
createDockWidget("Dock Panel 1", Qt::LeftDockWidgetArea);
createDockWidget("Dock Panel 2", Qt::RightDockWidgetArea);
createDockWidget("Dock Panel 3", Qt::TopDockWidgetArea);
createDockWidget("Dock Panel 4", Qt::BottomDockWidgetArea);
// Set window size and title
resize(1600, 1200);
setWindowTitle("Dockable Panels Example");
}
void MainWindow::createDockWidget(const QString &title, Qt::DockWidgetArea area)
{
// Create the dockable panel
QDockWidget *dockWidget = new QDockWidget(title, this);
dockWidget->setObjectName(title);
dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
dockWidget->setFeatures(QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetFloatable);
QTextEdit *textEdit = new QTextEdit(dockWidget);
textEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
dockWidget->setWidget(textEdit);
// Add the dock widget to the main window
addDockWidget(area, dockWidget);
// Set minimum sizes to prevent complete collapse
dockWidget->setMinimumWidth(100);
dockWidget->setMinimumHeight(100);
// Ensure docks are not floating initially
dockWidget->setFloating(false);
// Show the dock widget
dockWidget->show();
}
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
MainWindow mainWindow;
mainWindow.show();
return app.exec();
};
Feel free to submit a bug report at https://bugreports.qt.io, use the above as a reproducer and assign the ticket to me.
My guess is, that the minimum width/height don't get applied initially when the dock widgets are still docked.
Undocking and docking causes them to be applied.