forked from qt-creator/qt-creator
QML: Add an "external" editor for opening .ui.qml files in Design Studio
Using the logic from the landing page in design mode. Users can select Qt Design Studio from the Open With... menu, or even set it as the default editor in Preferences > Environment > MIME Types, "application/x-qt.ui+qml" Task-number: QTCREATORBUG-30754 Change-Id: Idd4e688f722dcf38735db7c1b9b31af02caeb045 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -100,11 +100,6 @@ static void clearAlwaysOpenWithMode()
|
|||||||
ICore::settings()->remove(QmlProjectManager::Constants::ALWAYS_OPEN_UI_MODE);
|
ICore::settings()->remove(QmlProjectManager::Constants::ALWAYS_OPEN_UI_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
class QmlProjectPluginPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
};
|
|
||||||
|
|
||||||
void openQDS(const FilePath &fileName)
|
void openQDS(const FilePath &fileName)
|
||||||
{
|
{
|
||||||
const FilePath qdsPath = qdsInstallationEntry();
|
const FilePath qdsPath = qdsInstallationEntry();
|
||||||
@@ -229,6 +224,26 @@ static QmlBuildSystem *qmlBuildSystemforFileNode(const FileNode *fileNode)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ExternalDesignStudioFactory : public Core::IEditorFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ExternalDesignStudioFactory()
|
||||||
|
{
|
||||||
|
setId("Qt.QtDesignStudio");
|
||||||
|
setDisplayName(Tr::tr("Qt Design Studio"));
|
||||||
|
setMimeTypes({Utils::Constants::QMLUI_MIMETYPE});
|
||||||
|
setEditorStarter([](const FilePath &filePath, [[maybe_unused]] QString *errorMessage) {
|
||||||
|
openInQDSWithProject(filePath);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void setupExternalDesignStudio()
|
||||||
|
{
|
||||||
|
static ExternalDesignStudioFactory theExternalDesignStudioFactory;
|
||||||
|
}
|
||||||
|
|
||||||
class QmlProjectPlugin final : public ExtensionSystem::IPlugin
|
class QmlProjectPlugin final : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -274,6 +289,7 @@ private:
|
|||||||
void QmlProjectPlugin::initialize()
|
void QmlProjectPlugin::initialize()
|
||||||
{
|
{
|
||||||
setupQmlProjectRunConfiguration();
|
setupQmlProjectRunConfiguration();
|
||||||
|
setupExternalDesignStudio();
|
||||||
|
|
||||||
if (!qmlDesignerEnabled()) {
|
if (!qmlDesignerEnabled()) {
|
||||||
m_landingPage = new QdsLandingPage();
|
m_landingPage = new QdsLandingPage();
|
||||||
|
Reference in New Issue
Block a user