ProjectExplorer: Make ProjectPanel a QScrollArea

Instead of a QWidget that haa a layout with a single QScrollArea item.

Change-Id: I46a2bd9c73af657ee9a18d292398f8a4eaf0c951
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2025-06-13 13:50:39 +02:00
parent a7d33dc2b0
commit 9154fb1634

View File

@@ -85,34 +85,27 @@ const int CONTENTS_MARGIN = 5;
const int BELOW_CONTENTS_MARGIN = 16; const int BELOW_CONTENTS_MARGIN = 16;
const int PanelVMargin = 14; const int PanelVMargin = 14;
class ProjectPanel final : public QWidget class ProjectPanel final : public QScrollArea
{ {
public: public:
explicit ProjectPanel(QWidget *inner, bool addGlobalSettings, bool addStretch) explicit ProjectPanel(QWidget *inner, bool addGlobalSettings, bool addStretch)
{ {
setWindowTitle(inner->windowTitle()); setWindowTitle(inner->windowTitle());
setFocusProxy(inner); setFocusProxy(inner);
setFrameStyle(QFrame::NoFrame);
setWidgetResizable(true);
setFocusPolicy(Qt::NoFocus);
auto root = new QWidget(nullptr); auto root = new QWidget;
root->setFocusPolicy(Qt::NoFocus); root->setFocusPolicy(Qt::NoFocus);
root->setContentsMargins(0, 0, 0, 0); root->setContentsMargins(0, 0, 0, 0);
setWidget(root);
const auto scroller = new QScrollArea(this);
scroller->setWidget(root);
scroller->setFrameStyle(QFrame::NoFrame);
scroller->setWidgetResizable(true);
scroller->setFocusPolicy(Qt::NoFocus);
// The layout holding the panel. // The layout holding the panel.
auto topLayout = new QVBoxLayout(root); auto topLayout = new QVBoxLayout(root);
topLayout->setContentsMargins(PanelVMargin, 0, PanelVMargin, 0); topLayout->setContentsMargins(PanelVMargin, 0, PanelVMargin, 0);
topLayout->setSpacing(0); topLayout->setSpacing(0);
auto layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->addWidget(scroller);
//layout->addWidget(new FindToolBarPlaceHolder(this)); //layout->addWidget(new FindToolBarPlaceHolder(this));
if (addGlobalSettings) { if (addGlobalSettings) {
@@ -169,8 +162,6 @@ public:
} }
}; };
class BuildSystemOutputWindow : public OutputWindow class BuildSystemOutputWindow : public OutputWindow
{ {
public: public: