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:
Thomas Hartmann
2020-12-14 17:43:03 +01:00
parent 30397fd2d4
commit c9638bf5ea
2 changed files with 13 additions and 0 deletions

View File

@@ -174,6 +174,9 @@ public:
ModelNode getNodeForCanonicalIndex(int index);
signals:
void modelInterfaceProjectUpdated();
protected: // functions
void importAdded(const Import &import);
void importRemoved(const Import &import);
@@ -191,6 +194,7 @@ private: //variables
ModelNode nodeAtTextCursorPositionHelper(const ModelNode &root, int cursorPosition) const;
void setupCanonicalHashes() const;
void handleLibraryInfoUpdate();
void handleProjectUpdate();
TextModifier *m_textModifier = nullptr;
int transactionLevel = 0;

View File

@@ -91,6 +91,10 @@ RewriterView::RewriterView(DifferenceHandling differenceHandling, QObject *paren
QmlJS::ModelManagerInterface *modelManager = QmlJS::ModelManagerInterface::instance();
connect(modelManager, &QmlJS::ModelManagerInterface::libraryInfoUpdated,
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;
@@ -832,6 +836,11 @@ void RewriterView::handleLibraryInfoUpdate()
m_amendTimer.start();
}
void RewriterView::handleProjectUpdate()
{
emit modelInterfaceProjectUpdated();
}
ModelNode RewriterView::nodeAtTextCursorPosition(int cursorPosition) const
{
return nodeAtTextCursorPositionHelper(rootModelNode(), cursorPosition);