forked from qt-creator/qt-creator
		
	use "qml" as QML runtime
Since Qt 6.2 qmlscene is deprecated by Qt. This patch also removes QMLViewer as a last QtQuick 1 artifact in external tools. Task-number: QDS-639 Task-number: QDS-4535 Task-number: QTCREATORBUG-22385 Change-Id: I5f67040954f8ef438961f7166a53bd96d5b73f4d Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
		@@ -77,15 +77,12 @@
 | 
			
		||||
    \uicontrol {Open With} > \uicontrol {Qt Linguist} in the context menu.
 | 
			
		||||
    For more information about Qt Linguist, see \l{Qt Linguist Manual}.
 | 
			
		||||
 | 
			
		||||
    \section1 Previewing QML Files
 | 
			
		||||
    \section1 Running QML Files
 | 
			
		||||
 | 
			
		||||
    You can preview the current QML document in the QML Viewer (Qt Quick 1) or
 | 
			
		||||
    QML Scene (Qt Quick 2). The preview tools enable you to load QML documents
 | 
			
		||||
    for viewing and testing while you are developing an application.
 | 
			
		||||
    You can test the current QML document while you are developing an application.
 | 
			
		||||
 | 
			
		||||
    To preview the currently active QML file, select \uicontrol Tools >
 | 
			
		||||
    \uicontrol External > \uicontrol {Qt Quick} > \uicontrol {Qt Quick 1 Preview
 | 
			
		||||
    (qmlviewer)} or \uicontrol {Qt Quick 2 Preview (qmlscene)}.
 | 
			
		||||
    To run the currently active QML file, select \uicontrol Tools >
 | 
			
		||||
    \uicontrol External > \uicontrol {Qt Quick} > \uicontrol {QML Runtime}.
 | 
			
		||||
 | 
			
		||||
    \section1 Using External Text Editors
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -78,10 +78,9 @@
 | 
			
		||||
        \li \l{Using External Tools}
 | 
			
		||||
 | 
			
		||||
            You can use external tools directly from \QC. Qt Linguist,
 | 
			
		||||
            QML preview tools (QML Viewer and QML Scene), the default text
 | 
			
		||||
            editor for your system, and the \c sort tool are preconfigured for
 | 
			
		||||
            use. You can change their default configurations and configure new
 | 
			
		||||
            tools.
 | 
			
		||||
            QML utilities, the default text editor for your system, and the
 | 
			
		||||
            \c sort tool are preconfigured for use. You can change their default
 | 
			
		||||
            configurations and configure new tools.
 | 
			
		||||
 | 
			
		||||
    \endlist
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@
 | 
			
		||||
    \if defined(qtdesignstudio)
 | 
			
		||||
    \section1 Selecting the Preview Tool
 | 
			
		||||
 | 
			
		||||
    By default, the \c qmlscene utility is used for previewing. To use some
 | 
			
		||||
    By default, the QML runtime is used for previewing. To use some
 | 
			
		||||
    other tool, specify it in the \uicontrol {QML viewer} field in the run
 | 
			
		||||
    settings of the project in the Projects mode.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -73,10 +73,9 @@
 | 
			
		||||
        \li \l{Using External Tools}
 | 
			
		||||
 | 
			
		||||
            You can use external tools directly from \QC. lupdate and lrelease,
 | 
			
		||||
            QML preview tools (QML Viewer and QML Scene), the default text
 | 
			
		||||
            editor for your system, and the \c sort tool are preconfigured for
 | 
			
		||||
            use. You can change their default configurations and configure new
 | 
			
		||||
            tools.
 | 
			
		||||
            QML utilities, the default text editor for your system, and the
 | 
			
		||||
            \c sort tool are preconfigured for use. You can change their default
 | 
			
		||||
            configurations and configure new tools.
 | 
			
		||||
        \li \l{Managing Data Collection}
 | 
			
		||||
 | 
			
		||||
            \if defined (qtcreator)
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
    "supportedProjectTypes": [ "QmlProjectManager.QmlProject" ],
 | 
			
		||||
    "id": "QA.QtQuickUi",
 | 
			
		||||
    "category": "H.Project",
 | 
			
		||||
    "trDescription": "Creates a Qt Quick 2 UI project with a QML entry point. To use it, you need to have a QML runtime environment such as qmlscene set up.\n\nUse this only if you are prototyping. You cannot create a full application with this. Consider using a Qt Quick Application project instead.",
 | 
			
		||||
    "trDescription": "Creates a Qt Quick 2 UI project with a QML entry point. To use it, you need to have a QML runtime environment.\n\nUse this only if you are prototyping. You cannot create a full application with this. Consider using a Qt Quick Application project instead.",
 | 
			
		||||
    "trDisplayName": "Qt Quick UI Prototype",
 | 
			
		||||
    "trDisplayCategory": "Other Project",
 | 
			
		||||
    "icon": "qtquickuiprototype.png",
 | 
			
		||||
 
 | 
			
		||||
@@ -57,8 +57,7 @@ Product {
 | 
			
		||||
            var list = [
 | 
			
		||||
                "lrelease.xml",
 | 
			
		||||
                "lupdate.xml",
 | 
			
		||||
                "qmlscene.xml",
 | 
			
		||||
                "qmlviewer.xml",
 | 
			
		||||
                "qml.xml",
 | 
			
		||||
            ]
 | 
			
		||||
            if (qbs.targetOS.contains("windows"))
 | 
			
		||||
                list.push("notepad_win.xml");
 | 
			
		||||
 
 | 
			
		||||
@@ -126,7 +126,7 @@ const char TimeoutKey[] = "Timeout";
 | 
			
		||||
const char HostKeyCheckingKey[] = "HostKeyChecking";
 | 
			
		||||
 | 
			
		||||
const char DebugServerKey[] = "DebugServerKey";
 | 
			
		||||
const char QmlsceneKey[] = "QmlsceneKey";
 | 
			
		||||
const char QmlRuntimeKey[] = "QmlsceneKey";
 | 
			
		||||
 | 
			
		||||
using AuthType = QSsh::SshConnectionParameters::AuthenticationType;
 | 
			
		||||
const AuthType DefaultAuthType = QSsh::SshConnectionParameters::AuthenticationTypeAll;
 | 
			
		||||
@@ -153,7 +153,7 @@ public:
 | 
			
		||||
    QSsh::SshConnectionParameters sshParameters;
 | 
			
		||||
    Utils::PortList freePorts;
 | 
			
		||||
    QString debugServerPath;
 | 
			
		||||
    QString qmlsceneCommand;
 | 
			
		||||
    QString qmlRunCommand;
 | 
			
		||||
    bool emptyCommandAllowed = false;
 | 
			
		||||
 | 
			
		||||
    QList<Utils::Icon> deviceIcons;
 | 
			
		||||
@@ -596,7 +596,7 @@ void IDevice::fromMap(const QVariantMap &map)
 | 
			
		||||
    d->version = map.value(QLatin1String(VersionKey), 0).toInt();
 | 
			
		||||
 | 
			
		||||
    d->debugServerPath = map.value(QLatin1String(DebugServerKey)).toString();
 | 
			
		||||
    d->qmlsceneCommand = map.value(QLatin1String(QmlsceneKey)).toString();
 | 
			
		||||
    d->qmlRunCommand = map.value(QLatin1String(QmlRuntimeKey)).toString();
 | 
			
		||||
    d->extraData = map.value(ExtraDataKey).toMap();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -627,7 +627,7 @@ QVariantMap IDevice::toMap() const
 | 
			
		||||
    map.insert(QLatin1String(VersionKey), d->version);
 | 
			
		||||
 | 
			
		||||
    map.insert(QLatin1String(DebugServerKey), d->debugServerPath);
 | 
			
		||||
    map.insert(QLatin1String(QmlsceneKey), d->qmlsceneCommand);
 | 
			
		||||
    map.insert(QLatin1String(QmlRuntimeKey), d->qmlRunCommand);
 | 
			
		||||
    map.insert(ExtraDataKey, d->extraData);
 | 
			
		||||
 | 
			
		||||
    return map;
 | 
			
		||||
@@ -710,14 +710,14 @@ void IDevice::setDebugServerPath(const QString &path)
 | 
			
		||||
    d->debugServerPath = path;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString IDevice::qmlsceneCommand() const
 | 
			
		||||
QString IDevice::qmlRunCommand() const
 | 
			
		||||
{
 | 
			
		||||
    return d->qmlsceneCommand;
 | 
			
		||||
    return d->qmlRunCommand;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void IDevice::setQmlsceneCommand(const QString &path)
 | 
			
		||||
void IDevice::setQmlRunCommand(const QString &path)
 | 
			
		||||
{
 | 
			
		||||
    d->qmlsceneCommand = path;
 | 
			
		||||
    d->qmlRunCommand = path;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void IDevice::setExtraData(Utils::Id kind, const QVariant &data)
 | 
			
		||||
 
 | 
			
		||||
@@ -214,8 +214,8 @@ public:
 | 
			
		||||
    QString debugServerPath() const;
 | 
			
		||||
    void setDebugServerPath(const QString &path);
 | 
			
		||||
 | 
			
		||||
    QString qmlsceneCommand() const;
 | 
			
		||||
    void setQmlsceneCommand(const QString &path);
 | 
			
		||||
    QString qmlRunCommand() const;
 | 
			
		||||
    void setQmlRunCommand(const QString &path);
 | 
			
		||||
 | 
			
		||||
    void setExtraData(Utils::Id kind, const QVariant &data);
 | 
			
		||||
    QVariant extraData(Utils::Id kind) const;
 | 
			
		||||
 
 | 
			
		||||
@@ -375,7 +375,7 @@ Tasks QmlProject::projectIssues(const Kit *k) const
 | 
			
		||||
        if (version->type() == QtSupport::Constants::DESKTOPQT) {
 | 
			
		||||
            if (version->qmlsceneCommand().isEmpty()) {
 | 
			
		||||
                result.append(createProjectTask(Task::TaskType::Error,
 | 
			
		||||
                                                tr("Qt version has no qmlscene command.")));
 | 
			
		||||
                                                tr("Qt version has no QML utility.")));
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            // Non-desktop Qt on a desktop device? We don't support that.
 | 
			
		||||
@@ -383,8 +383,8 @@ Tasks QmlProject::projectIssues(const Kit *k) const
 | 
			
		||||
                                            tr("Non-desktop Qt is used with a desktop device.")));
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        // If not a desktop device, don't check the Qt version for qmlscene.
 | 
			
		||||
        // The device is responsible for providing it and we assume qmlscene can be found
 | 
			
		||||
        // If not a desktop device, don't check the Qt version for qml runtime binary.
 | 
			
		||||
        // The device is responsible for providing it and we assume qml runtime can be found
 | 
			
		||||
        // in $PATH if it's not explicitly given.
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -141,7 +141,7 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
 | 
			
		||||
        r.workingDirectory = bs->targetDirectory().toString();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    setDisplayName(tr("QML Scene", "QMLRunConfiguration display name."));
 | 
			
		||||
    setDisplayName(tr("QML Utility", "QMLRunConfiguration display name."));
 | 
			
		||||
    update();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -154,10 +154,10 @@ QString QmlProjectRunConfiguration::disabledReason() const
 | 
			
		||||
    if (DeviceTypeKitAspect::deviceTypeId(kit())
 | 
			
		||||
            == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE
 | 
			
		||||
            && !viewer.exists()) {
 | 
			
		||||
        return tr("No qmlscene found.");
 | 
			
		||||
        return tr("No QML utility found.");
 | 
			
		||||
    }
 | 
			
		||||
    if (viewer.isEmpty())
 | 
			
		||||
        return tr("No qmlscene binary specified for target device.");
 | 
			
		||||
        return tr("No QML utility specified for target device.");
 | 
			
		||||
    return RunConfiguration::disabledReason();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -169,7 +169,7 @@ FilePath QmlProjectRunConfiguration::qmlScenePath() const
 | 
			
		||||
 | 
			
		||||
    Kit *kit = target()->kit();
 | 
			
		||||
    BaseQtVersion *version = QtKitAspect::qtVersion(kit);
 | 
			
		||||
    if (!version) // No Qt version in Kit. Don't try to run qmlscene.
 | 
			
		||||
    if (!version) // No Qt version in Kit. Don't try to run QML runtime.
 | 
			
		||||
        return {};
 | 
			
		||||
 | 
			
		||||
    const Id deviceType = DeviceTypeKitAspect::deviceTypeId(kit);
 | 
			
		||||
@@ -180,10 +180,10 @@ FilePath QmlProjectRunConfiguration::qmlScenePath() const
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    IDevice::ConstPtr dev = DeviceKitAspect::device(kit);
 | 
			
		||||
    if (dev.isNull()) // No device set. We don't know where to run qmlscene.
 | 
			
		||||
    if (dev.isNull()) // No device set. We don't know where a QML utility is.
 | 
			
		||||
        return {};
 | 
			
		||||
 | 
			
		||||
    const QString qmlscene = dev->qmlsceneCommand();
 | 
			
		||||
    const QString qmlscene = dev->qmlRunCommand();
 | 
			
		||||
    // If not given explicitly by device, try to pick it from $PATH.
 | 
			
		||||
    return FilePath::fromString(qmlscene.isEmpty() ? QString("qmlscene") : qmlscene);
 | 
			
		||||
}
 | 
			
		||||
@@ -237,10 +237,10 @@ QString QmlProjectRunConfiguration::mainScript() const
 | 
			
		||||
// QmlProjectRunConfigurationFactory
 | 
			
		||||
 | 
			
		||||
QmlProjectRunConfigurationFactory::QmlProjectRunConfigurationFactory()
 | 
			
		||||
    : FixedRunConfigurationFactory(QmlProjectRunConfiguration::tr("QML Scene"), false)
 | 
			
		||||
    : FixedRunConfigurationFactory(QmlProjectRunConfiguration::tr("QML Runtime"), false)
 | 
			
		||||
{
 | 
			
		||||
    registerRunConfiguration<QmlProjectRunConfiguration>
 | 
			
		||||
            ("QmlProjectManager.QmlRunConfiguration.QmlScene");
 | 
			
		||||
            ("QmlProjectManager.QmlRunConfiguration.Qml");
 | 
			
		||||
    addSupportedProjectType(QmlProjectManager::Constants::QML_PROJECT_ID);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1041,7 +1041,12 @@ FilePath BaseQtVersion::qmlsceneCommand() const
 | 
			
		||||
    if (!d->m_qmlsceneCommand.isEmpty())
 | 
			
		||||
        return d->m_qmlsceneCommand;
 | 
			
		||||
 | 
			
		||||
    const FilePath path = binPath() / HostOsInfo::withExecutableSuffix("qmlscene");
 | 
			
		||||
    FilePath path = binPath();
 | 
			
		||||
    if (qtVersion() >= QtVersionNumber(6, 2, 0))
 | 
			
		||||
        path = path / HostOsInfo::withExecutableSuffix("qml");
 | 
			
		||||
    else
 | 
			
		||||
        path = path / HostOsInfo::withExecutableSuffix("qmlscene");
 | 
			
		||||
 | 
			
		||||
    d->m_qmlsceneCommand = path.isExecutableFile() ? path : FilePath();
 | 
			
		||||
 | 
			
		||||
    return d->m_qmlsceneCommand;
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ QStringList DesktopQtVersion::warningReason() const
 | 
			
		||||
    QStringList ret = BaseQtVersion::warningReason();
 | 
			
		||||
    if (qtVersion() >= QtVersionNumber(5, 0, 0)) {
 | 
			
		||||
        if (qmlsceneCommand().isEmpty())
 | 
			
		||||
            ret << QCoreApplication::translate("QtVersion", "No qmlscene installed.");
 | 
			
		||||
            ret << QCoreApplication::translate("QtVersion", "No QML utility installed.");
 | 
			
		||||
    }
 | 
			
		||||
    return ret;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,8 +9,7 @@ STATIC_INSTALL_BASE = $$INSTALL_DATA_PATH
 | 
			
		||||
STATIC_FILES = \
 | 
			
		||||
    $$PWD/externaltools/lrelease.xml \
 | 
			
		||||
    $$PWD/externaltools/lupdate.xml \
 | 
			
		||||
    $$PWD/externaltools/qmlviewer.xml \
 | 
			
		||||
    $$PWD/externaltools/qmlscene.xml
 | 
			
		||||
    $$PWD/externaltools/qml.xml
 | 
			
		||||
unix {
 | 
			
		||||
    osx:STATIC_FILES += $$PWD/externaltools/vi_mac.xml
 | 
			
		||||
    else:STATIC_FILES += $$PWD/externaltools/vi.xml
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
set(EXT_TOOLS_DIR "${IDE_DATA_PATH}/externaltools")
 | 
			
		||||
 | 
			
		||||
set(tools lrelease.xml lupdate.xml qmlscene.xml qmlviewer.xml)
 | 
			
		||||
set(tools lrelease.xml lupdate.xml qmlscene.xml qml.xml)
 | 
			
		||||
 | 
			
		||||
if (WIN32)
 | 
			
		||||
  list(APPEND tools notepad_win.xml)
 | 
			
		||||
 
 | 
			
		||||
@@ -26,14 +26,14 @@
 | 
			
		||||
****************************************************************************/
 | 
			
		||||
 | 
			
		||||
-->
 | 
			
		||||
<externaltool id="qmlviewer">
 | 
			
		||||
    <description>Runs the current QML file with qmlviewer</description>
 | 
			
		||||
    <displayname>Qt Quick 1 Preview (qmlviewer)</displayname>
 | 
			
		||||
<externaltool id="qml">
 | 
			
		||||
    <description>Runs the current QML file with QML utility.</description>
 | 
			
		||||
    <displayname>QML utility</displayname>
 | 
			
		||||
    <category>Qt Quick</category>
 | 
			
		||||
    <order>1</order>
 | 
			
		||||
    <executable>
 | 
			
		||||
        <path>%{CurrentDocument:Project:QT_INSTALL_BINS}/qmlviewer</path>
 | 
			
		||||
        <path>qmlviewer</path>
 | 
			
		||||
        <path>%{CurrentProject:QT_INSTALL_BINS}/qml</path>
 | 
			
		||||
        <path>qml</path>
 | 
			
		||||
        <arguments>%{CurrentDocument:FilePath}</arguments>
 | 
			
		||||
        <workingdirectory>%{CurrentDocument:Path}</workingdirectory>
 | 
			
		||||
        <environment>QT_LOGGING_TO_CONSOLE%3D1</environment>
 | 
			
		||||
@@ -102,7 +102,7 @@ def waitForCleanShutdown(timeOut=10):
 | 
			
		||||
    shutdownDone = (str(appCtxt)=="")
 | 
			
		||||
    if platform.system() in ('Windows','Microsoft'):
 | 
			
		||||
        # cleaning helper for running on the build machines
 | 
			
		||||
        checkForStillRunningQmlExecutable(['qmlviewer.exe', 'qmlscene.exe'])
 | 
			
		||||
        checkForStillRunningQmlExecutable(['qmlscene.exe', 'qml.exe'])
 | 
			
		||||
        endtime = datetime.utcnow() + timedelta(seconds=timeOut)
 | 
			
		||||
        while not shutdownDone:
 | 
			
		||||
            # following work-around because os.kill() works for win not until python 2.7
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,7 @@ def main():
 | 
			
		||||
                        "Verifying Run and Debug are enabled (Qt5 is available).")
 | 
			
		||||
            and test.compare(target, Targets.getStringForTarget(Targets.getDefaultKit()),
 | 
			
		||||
                             "Verifying selected Target is Qt5.")
 | 
			
		||||
            and test.compare(exe, "QML Scene", "Verifying selected executable is QML Scene.")):
 | 
			
		||||
            and test.compare(exe, "QML Utility", "Verifying selected executable is QML Utility.")):
 | 
			
		||||
        earlyExit("Something went wrong opening Qml project - probably missing Qt5.")
 | 
			
		||||
        return
 | 
			
		||||
    switchViewTo(ViewConstants.PROJECTS)
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ def main():
 | 
			
		||||
            __closeSubprocessByPushingStop__(True)
 | 
			
		||||
        appOutput = logApplicationOutput()
 | 
			
		||||
        test.verify(_exactlyOne_(map(lambda ver: ver in appOutput, available)),
 | 
			
		||||
                    "Does Creator use qmlscene from a checked kit?")
 | 
			
		||||
                    "Does Qt Creator use QML binary from a checked kit?")
 | 
			
		||||
        test.verify(projectName + ".qml:" not in appOutput,
 | 
			
		||||
                    "Does the Application Output indicate QML errors?")
 | 
			
		||||
        invokeMenuItem("File", "Close All Projects and Editors")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user