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:
Burak Hancerli
2023-01-05 18:37:28 +01:00
committed by Thomas Hartmann
parent ac93351c93
commit fb14965dfe
2 changed files with 12 additions and 12 deletions

View File

@@ -41,18 +41,22 @@ public:
, m_args({argc, argv})
{
m_argParser.setApplicationDescription("QML Runtime Provider for QDS");
m_argParser.addOptions(
{{"qml-puppet", "Run QML Puppet (default)"},
m_argParser.addOptions({{"qml-puppet", "Run QML Puppet (default)"},
{"qml-runtime", "Run QML Runtime"},
{"appinfo", "Print build information"},
{"test", "Run test mode"}
});
{"test", "Run test mode"}});
}
int run()
{
populateParser();
initCoreApp();
if (!m_coreApp) { //default to QGuiApplication
createCoreApp<QGuiApplication>();
qWarning() << "CoreApp is not initialized! Falling back to QGuiApplication!";
}
initParser();
initQmlRunner();
return m_coreApp->exec();
@@ -89,11 +93,6 @@ private:
QCommandLineOption optHelp = m_argParser.addHelpOption();
QCommandLineOption optVers = m_argParser.addVersionOption();
if (!m_coreApp) {
qCritical() << "Cannot initialize coreapp!";
m_argParser.showHelp();
}
if (!m_argParser.parse(m_coreApp->arguments())) {
std::cout << "Error: " << m_argParser.errorText().toStdString() << std::endl
<< std::endl;

View File

@@ -241,7 +241,8 @@ void QmlRuntime::initQmlRunner()
loadConf(confFile, !m_verboseMode);
// 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)) {
QUrl url = QUrl::fromUserInput(path, QDir::currentPath(), QUrl::AssumeLocalFile);