Allow shrinking the main window

The welcome screen's minimum size is quite large.  This change allows
the window to be smaller than the welcome screen when the welcome screen
is not visible.

BUG: 478577

Before and after screenshot:
![Before and after screenshot](/uploads/71f685c89a7324444b89e1abd0592b80/image.png)
This commit is contained in:
Scott Worley 2023-12-17 21:39:48 +00:00 committed by Albert Astals Cid
parent 1cbb5f0e00
commit db2246f777

View file

@ -70,6 +70,21 @@ static const char *const SESSION_TAB_KEY = "ActiveTab";
static constexpr char SIDEBAR_LOCKED_KEY[] = "LockSidebar"; static constexpr char SIDEBAR_LOCKED_KEY[] = "LockSidebar";
static constexpr char SIDEBAR_VISIBLE_KEY[] = "ShowSidebar"; static constexpr char SIDEBAR_VISIBLE_KEY[] = "ShowSidebar";
class ResizableStackedWidget : public QStackedWidget
{
Q_OBJECT
public:
QSize sizeHint() const override
{
return currentWidget()->sizeHint();
}
QSize minimumSizeHint() const override
{
return currentWidget()->minimumSizeHint();
}
};
/** /**
* Groups sidebar containers in a QDockWidget. * Groups sidebar containers in a QDockWidget.
* *
@ -184,7 +199,7 @@ Shell::Shell(const QString &serializedOptions)
KParts::ReadWritePart *const firstPart = m_partFactory->create<KParts::ReadWritePart>(this); KParts::ReadWritePart *const firstPart = m_partFactory->create<KParts::ReadWritePart>(this);
if (firstPart) { if (firstPart) {
// Setup the central widget // Setup the central widget
m_centralStackedWidget = new QStackedWidget(); m_centralStackedWidget = new ResizableStackedWidget();
setCentralWidget(m_centralStackedWidget); setCentralWidget(m_centralStackedWidget);
// Setup the welcome screen // Setup the welcome screen