forked from qt-creator/qt-creator
QmlDesigner: fix for coreApp initialization problem and loadwatcher scope failure
Change-Id: I7a82cdd32757a7d37a0e88fad3e0f83527e49094 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Thomas Hartmann
parent
ac93351c93
commit
fb14965dfe
@@ -41,18 +41,22 @@ public:
|
|||||||
, m_args({argc, argv})
|
, m_args({argc, argv})
|
||||||
{
|
{
|
||||||
m_argParser.setApplicationDescription("QML Runtime Provider for QDS");
|
m_argParser.setApplicationDescription("QML Runtime Provider for QDS");
|
||||||
m_argParser.addOptions(
|
m_argParser.addOptions({{"qml-puppet", "Run QML Puppet (default)"},
|
||||||
{{"qml-puppet", "Run QML Puppet (default)"},
|
{"qml-runtime", "Run QML Runtime"},
|
||||||
{"qml-runtime", "Run QML Runtime"},
|
{"appinfo", "Print build information"},
|
||||||
{"appinfo", "Print build information"},
|
{"test", "Run test mode"}});
|
||||||
{"test", "Run test mode"}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int run()
|
int run()
|
||||||
{
|
{
|
||||||
populateParser();
|
populateParser();
|
||||||
initCoreApp();
|
initCoreApp();
|
||||||
|
|
||||||
|
if (!m_coreApp) { //default to QGuiApplication
|
||||||
|
createCoreApp<QGuiApplication>();
|
||||||
|
qWarning() << "CoreApp is not initialized! Falling back to QGuiApplication!";
|
||||||
|
}
|
||||||
|
|
||||||
initParser();
|
initParser();
|
||||||
initQmlRunner();
|
initQmlRunner();
|
||||||
return m_coreApp->exec();
|
return m_coreApp->exec();
|
||||||
@@ -89,11 +93,6 @@ private:
|
|||||||
QCommandLineOption optHelp = m_argParser.addHelpOption();
|
QCommandLineOption optHelp = m_argParser.addHelpOption();
|
||||||
QCommandLineOption optVers = m_argParser.addVersionOption();
|
QCommandLineOption optVers = m_argParser.addVersionOption();
|
||||||
|
|
||||||
if (!m_coreApp) {
|
|
||||||
qCritical() << "Cannot initialize coreapp!";
|
|
||||||
m_argParser.showHelp();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_argParser.parse(m_coreApp->arguments())) {
|
if (!m_argParser.parse(m_coreApp->arguments())) {
|
||||||
std::cout << "Error: " << m_argParser.errorText().toStdString() << std::endl
|
std::cout << "Error: " << m_argParser.errorText().toStdString() << std::endl
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@@ -241,7 +241,8 @@ void QmlRuntime::initQmlRunner()
|
|||||||
loadConf(confFile, !m_verboseMode);
|
loadConf(confFile, !m_verboseMode);
|
||||||
|
|
||||||
// Load files
|
// Load files
|
||||||
QScopedPointer<LoadWatcher> lw(new LoadWatcher(m_qmlEngine.data(), files.size(), m_conf.data()));
|
LoadWatcher *lw = new LoadWatcher(m_qmlEngine.data(), files.size(), m_conf.data());
|
||||||
|
lw->setParent(this);
|
||||||
|
|
||||||
for (const QString &path : std::as_const(files)) {
|
for (const QString &path : std::as_const(files)) {
|
||||||
QUrl url = QUrl::fromUserInput(path, QDir::currentPath(), QUrl::AssumeLocalFile);
|
QUrl url = QUrl::fromUserInput(path, QDir::currentPath(), QUrl::AssumeLocalFile);
|
||||||
|
Reference in New Issue
Block a user