Launcher: port the QQC2 check to next
Since we require QQC2 on next, make it a critical warning.
This commit is contained in:
parent
e028c52e42
commit
29d171e73a
2 changed files with 30 additions and 0 deletions
|
@ -82,6 +82,13 @@ LauncherMainWindow::LauncherMainWindow(bool inSimMode) : QQuickView()
|
|||
connect(qa, &QAction::triggered, m_controller, &LauncherController::quit);
|
||||
}
|
||||
|
||||
if (!checkQQC2Availability()) {
|
||||
QMessageBox::critical(nullptr, "Missing required component",
|
||||
tr("Your system is missing a required UI component (QtQuick Controls 2). "
|
||||
"This normally occurs on Linux platforms where Qt is split into many small packages. "
|
||||
"On Ubuntu/Debian systems, the package is called 'qml-module-qtquick-controls2'"));
|
||||
}
|
||||
|
||||
connect(this, &QQuickView::statusChanged, this, &LauncherMainWindow::onQuickStatusChanged);
|
||||
|
||||
m_controller->initialRestoreSettings();
|
||||
|
@ -147,6 +154,27 @@ void LauncherMainWindow::onQuickStatusChanged(QQuickView::Status status)
|
|||
}
|
||||
}
|
||||
|
||||
bool LauncherMainWindow::checkQQC2Availability()
|
||||
{
|
||||
QQmlComponent comp(engine());
|
||||
comp.setData(R"(
|
||||
import QtQuick.Controls 2.0
|
||||
ScrollBar {
|
||||
}
|
||||
)",
|
||||
{});
|
||||
if (comp.isError()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
auto item = comp.create();
|
||||
const bool haveQQC2 = (item != nullptr);
|
||||
if (item)
|
||||
item->deleteLater();
|
||||
return haveQQC2;
|
||||
}
|
||||
|
||||
LauncherMainWindow::~LauncherMainWindow()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ private slots:
|
|||
void onQuickStatusChanged(QQuickView::Status status);
|
||||
|
||||
private:
|
||||
bool checkQQC2Availability();
|
||||
|
||||
LauncherController* m_controller;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue