Launcher: nicer min-window-size computation
This commit is contained in:
parent
b7e98caecf
commit
6475ae32b1
5 changed files with 30 additions and 4 deletions
|
@ -790,3 +790,12 @@ void LauncherController::saveConfigAs()
|
||||||
|
|
||||||
m_config->saveConfigToFile(file);
|
m_config->saveConfigToFile(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LauncherController::setMinWindowSize(QSize sz)
|
||||||
|
{
|
||||||
|
if (sz == m_minWindowSize)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_window->setMinimumSize(sz);
|
||||||
|
emit minWindowSizeChanged();
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
#include <QSize>
|
||||||
|
|
||||||
#include <simgear/package/Package.hxx>
|
#include <simgear/package/Package.hxx>
|
||||||
#include <simgear/package/Catalog.hxx>
|
#include <simgear/package/Catalog.hxx>
|
||||||
|
@ -78,6 +79,9 @@ class LauncherController : public QObject
|
||||||
Q_PROPERTY(bool canFly READ canFly NOTIFY canFlyChanged)
|
Q_PROPERTY(bool canFly READ canFly NOTIFY canFlyChanged)
|
||||||
|
|
||||||
Q_PROPERTY(AircraftType aircraftType READ aircraftType NOTIFY selectedAircraftChanged)
|
Q_PROPERTY(AircraftType aircraftType READ aircraftType NOTIFY selectedAircraftChanged)
|
||||||
|
|
||||||
|
Q_PROPERTY(QSize minimumWindowSize READ minWindowSize WRITE setMinWindowSize NOTIFY minWindowSizeChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LauncherController(QObject *parent, QWindow* win);
|
explicit LauncherController(QObject *parent, QWindow* win);
|
||||||
|
|
||||||
|
@ -168,6 +172,13 @@ public:
|
||||||
void setInAppMode();
|
void setInAppMode();
|
||||||
bool keepRunningInAppMode() const;
|
bool keepRunningInAppMode() const;
|
||||||
bool inAppResult() const;
|
bool inAppResult() const;
|
||||||
|
|
||||||
|
QSize minWindowSize() const
|
||||||
|
{
|
||||||
|
return m_minWindowSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMinWindowSize(QSize sz);
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void selectedAircraftChanged(QUrl selectedAircraft);
|
void selectedAircraftChanged(QUrl selectedAircraft);
|
||||||
|
@ -175,7 +186,7 @@ signals:
|
||||||
|
|
||||||
void searchChanged();
|
void searchChanged();
|
||||||
void summaryChanged();
|
void summaryChanged();
|
||||||
|
void minWindowSizeChanged();
|
||||||
void canFlyChanged();
|
void canFlyChanged();
|
||||||
|
|
||||||
void viewCommandLine();
|
void viewCommandLine();
|
||||||
|
@ -245,7 +256,7 @@ private:
|
||||||
QStringList m_settingsSummary, m_environmentSummary;
|
QStringList m_settingsSummary, m_environmentSummary;
|
||||||
RecentAircraftModel* m_aircraftHistory = nullptr;
|
RecentAircraftModel* m_aircraftHistory = nullptr;
|
||||||
RecentLocationsModel* m_locationHistory = nullptr;
|
RecentLocationsModel* m_locationHistory = nullptr;
|
||||||
|
QSize m_minWindowSize;
|
||||||
QTimer* m_subsystemIdleTimer = nullptr;
|
QTimer* m_subsystemIdleTimer = nullptr;
|
||||||
|
|
||||||
bool m_inAppMode = false;
|
bool m_inAppMode = false;
|
||||||
|
|
|
@ -94,8 +94,6 @@ LauncherMainWindow::LauncherMainWindow() :
|
||||||
ctx->setContextProperty("_weatherScenarios", weatherScenariosModel);
|
ctx->setContextProperty("_weatherScenarios", weatherScenariosModel);
|
||||||
|
|
||||||
setSource(QUrl("qrc:///qml/Launcher.qml"));
|
setSource(QUrl("qrc:///qml/Launcher.qml"));
|
||||||
|
|
||||||
setMinimumSize(QSize(300, 400));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -27,6 +27,11 @@ Item {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component.onCompleted:
|
||||||
|
{
|
||||||
|
_launcher.minimumWindowSize = Qt.size(Style.strutSize * 12, sidebar.minimumHeight);
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: _location
|
target: _location
|
||||||
onSkipFromArgsChanged: pagesModel.setProperty(2, "buttonDisabled", _location.skipFromArgs)
|
onSkipFromArgsChanged: pagesModel.setProperty(2, "buttonDisabled", _location.skipFromArgs)
|
||||||
|
|
|
@ -10,6 +10,8 @@ Rectangle {
|
||||||
property int selectedPage: 0
|
property int selectedPage: 0
|
||||||
property alias showMenuIcon: menuIcon.visible
|
property alias showMenuIcon: menuIcon.visible
|
||||||
|
|
||||||
|
readonly property int minimumHeight: mainColumn.childrenRect.height + flyButton.height
|
||||||
|
|
||||||
signal selectPage(var pageSource);
|
signal selectPage(var pageSource);
|
||||||
|
|
||||||
signal showMenu();
|
signal showMenu();
|
||||||
|
@ -20,6 +22,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
id: mainColumn
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: flyButton.top
|
anchors.bottom: flyButton.top
|
||||||
|
|
Loading…
Add table
Reference in a new issue