1
0
Fork 0

Launcher: nicer min-window-size computation

This commit is contained in:
James Turner 2018-07-02 11:49:34 +01:00
parent b7e98caecf
commit 6475ae32b1
5 changed files with 30 additions and 4 deletions

View file

@ -790,3 +790,12 @@ void LauncherController::saveConfigAs()
m_config->saveConfigToFile(file);
}
void LauncherController::setMinWindowSize(QSize sz)
{
if (sz == m_minWindowSize)
return;
m_window->setMinimumSize(sz);
emit minWindowSizeChanged();
}

View file

@ -24,6 +24,7 @@
#include <QObject>
#include <QUrl>
#include <QModelIndex>
#include <QSize>
#include <simgear/package/Package.hxx>
#include <simgear/package/Catalog.hxx>
@ -78,6 +79,9 @@ class LauncherController : public QObject
Q_PROPERTY(bool canFly READ canFly NOTIFY canFlyChanged)
Q_PROPERTY(AircraftType aircraftType READ aircraftType NOTIFY selectedAircraftChanged)
Q_PROPERTY(QSize minimumWindowSize READ minWindowSize WRITE setMinWindowSize NOTIFY minWindowSizeChanged)
public:
explicit LauncherController(QObject *parent, QWindow* win);
@ -168,6 +172,13 @@ public:
void setInAppMode();
bool keepRunningInAppMode() const;
bool inAppResult() const;
QSize minWindowSize() const
{
return m_minWindowSize;
}
void setMinWindowSize(QSize sz);
signals:
void selectedAircraftChanged(QUrl selectedAircraft);
@ -175,7 +186,7 @@ signals:
void searchChanged();
void summaryChanged();
void minWindowSizeChanged();
void canFlyChanged();
void viewCommandLine();
@ -245,7 +256,7 @@ private:
QStringList m_settingsSummary, m_environmentSummary;
RecentAircraftModel* m_aircraftHistory = nullptr;
RecentLocationsModel* m_locationHistory = nullptr;
QSize m_minWindowSize;
QTimer* m_subsystemIdleTimer = nullptr;
bool m_inAppMode = false;

View file

@ -94,8 +94,6 @@ LauncherMainWindow::LauncherMainWindow() :
ctx->setContextProperty("_weatherScenarios", weatherScenariosModel);
setSource(QUrl("qrc:///qml/Launcher.qml"));
setMinimumSize(QSize(300, 400));
}
#if 0

View file

@ -27,6 +27,11 @@ Item {
}
Component.onCompleted:
{
_launcher.minimumWindowSize = Qt.size(Style.strutSize * 12, sidebar.minimumHeight);
}
Connections {
target: _location
onSkipFromArgsChanged: pagesModel.setProperty(2, "buttonDisabled", _location.skipFromArgs)

View file

@ -10,6 +10,8 @@ Rectangle {
property int selectedPage: 0
property alias showMenuIcon: menuIcon.visible
readonly property int minimumHeight: mainColumn.childrenRect.height + flyButton.height
signal selectPage(var pageSource);
signal showMenu();
@ -20,6 +22,7 @@ Rectangle {
}
Column {
id: mainColumn
width: parent.width
anchors.top: parent.top
anchors.bottom: flyButton.top