forked from qt-creator/qt-creator
QmlDesigner: Update qrc files
This triggers an update on every qrc file. Change-Id: Id34873e3bd8190d79773fbc3a8a90699d4e49cb0 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
@@ -46,6 +46,8 @@
|
||||
#include <qtsupport/qtversionmanager.h>
|
||||
#include <coreplugin/idocument.h>
|
||||
|
||||
#include <qmljs/qmljsmodelmanagerinterface.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
@@ -243,12 +245,17 @@ void DesignDocument::loadDocument(QPlainTextEdit *edit)
|
||||
this, SIGNAL(dirtyStateChanged(bool)));
|
||||
|
||||
m_documentTextModifier.reset(new BaseTextEditModifier(dynamic_cast<TextEditor::TextEditorWidget*>(plainTextEdit())));
|
||||
|
||||
connect(m_documentTextModifier.data(), &TextModifier::textChanged, this, &DesignDocument::updateQrcFiles);
|
||||
|
||||
m_documentModel->setTextModifier(m_documentTextModifier.data());
|
||||
|
||||
m_inFileComponentTextModifier.reset();
|
||||
|
||||
updateFileName(Utils::FileName(), fileName());
|
||||
|
||||
updateQrcFiles();
|
||||
|
||||
m_documentLoaded = true;
|
||||
}
|
||||
|
||||
@@ -277,6 +284,18 @@ void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textMod
|
||||
viewManager().attachViewsExceptRewriterAndComponetView();
|
||||
}
|
||||
|
||||
void DesignDocument::updateQrcFiles()
|
||||
{
|
||||
ProjectExplorer::Project *currentProject = ProjectExplorer::SessionManager::projectForFile(fileName());
|
||||
|
||||
if (currentProject) {
|
||||
foreach (const QString &fileName, currentProject->files(ProjectExplorer::Project::SourceFiles)) {
|
||||
if (fileName.endsWith(".qrc"))
|
||||
QmlJS::ModelManagerInterface::instance()->updateQrcFile(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DesignDocument::changeToSubComponent(const ModelNode &componentNode)
|
||||
{
|
||||
if (QmlDesignerPlugin::instance()->currentDesignDocument() != this)
|
||||
|
@@ -124,6 +124,8 @@ private slots:
|
||||
private: // functions
|
||||
void changeToInFileComponentModel(ComponentTextModifier *textModifer);
|
||||
|
||||
void updateQrcFiles();
|
||||
|
||||
QWidget *centralWidget() const;
|
||||
QString pathToQt() const;
|
||||
|
||||
|
Reference in New Issue
Block a user