forked from qt-creator/qt-creator
QmlDesigner: Also react to ModelManagerInterface::projectInfoUpdated
If a new file is added to the project we have to react to projectInfoUpdated. Since the signal cannot be queued we use an indirection. Task-number: QDS-3113 Change-Id: I13e6a9623e3c51384435ee9dfd10576a77df3e35 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -174,6 +174,9 @@ public:
|
|||||||
|
|
||||||
ModelNode getNodeForCanonicalIndex(int index);
|
ModelNode getNodeForCanonicalIndex(int index);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void modelInterfaceProjectUpdated();
|
||||||
|
|
||||||
protected: // functions
|
protected: // functions
|
||||||
void importAdded(const Import &import);
|
void importAdded(const Import &import);
|
||||||
void importRemoved(const Import &import);
|
void importRemoved(const Import &import);
|
||||||
@@ -191,6 +194,7 @@ private: //variables
|
|||||||
ModelNode nodeAtTextCursorPositionHelper(const ModelNode &root, int cursorPosition) const;
|
ModelNode nodeAtTextCursorPositionHelper(const ModelNode &root, int cursorPosition) const;
|
||||||
void setupCanonicalHashes() const;
|
void setupCanonicalHashes() const;
|
||||||
void handleLibraryInfoUpdate();
|
void handleLibraryInfoUpdate();
|
||||||
|
void handleProjectUpdate();
|
||||||
|
|
||||||
TextModifier *m_textModifier = nullptr;
|
TextModifier *m_textModifier = nullptr;
|
||||||
int transactionLevel = 0;
|
int transactionLevel = 0;
|
||||||
|
@@ -91,6 +91,10 @@ RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *paren
|
|||||||
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
|
||||||
connect(modelManager, &QmlJS::ModelManagerInterface::libraryInfoUpdated,
|
connect(modelManager, &QmlJS::ModelManagerInterface::libraryInfoUpdated,
|
||||||
this, &RewriterView::handleLibraryInfoUpdate, Qt::QueuedConnection);
|
this, &RewriterView::handleLibraryInfoUpdate, Qt::QueuedConnection);
|
||||||
|
connect(modelManager, &QmlJS::ModelManagerInterface::projectInfoUpdated,
|
||||||
|
this, &RewriterView::handleProjectUpdate, Qt::DirectConnection);
|
||||||
|
connect(this, &RewriterView::modelInterfaceProjectUpdated,
|
||||||
|
this, &RewriterView::handleLibraryInfoUpdate, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
RewriterView::~RewriterView() = default;
|
RewriterView::~RewriterView() = default;
|
||||||
@@ -832,6 +836,11 @@ void RewriterView::handleLibraryInfoUpdate()
|
|||||||
m_amendTimer.start();
|
m_amendTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RewriterView::handleProjectUpdate()
|
||||||
|
{
|
||||||
|
emit modelInterfaceProjectUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
ModelNode RewriterView::nodeAtTextCursorPosition(int cursorPosition) const
|
ModelNode RewriterView::nodeAtTextCursorPosition(int cursorPosition) const
|
||||||
{
|
{
|
||||||
return nodeAtTextCursorPositionHelper(rootModelNode(), cursorPosition);
|
return nodeAtTextCursorPositionHelper(rootModelNode(), cursorPosition);
|
||||||
|
Reference in New Issue
Block a user