Commit dfa76d74 authored by Christian Stenger's avatar Christian Stenger
Browse files

ProjectExplorer: Fix compile for Qt version less than 5.4



Change-Id: Ic2500d009d2195d19651ac691c42d55a612fde04
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 7b226fff
......@@ -289,12 +289,7 @@ void ProjectTree::foldersAboutToBeRemoved(FolderNode *, const QList<FolderNode*>
void ProjectTree::foldersRemoved()
{
QTimer::singleShot(0, [this]() {
if (m_resetCurrentNodeFolder) {
updateFromFocus(true);
m_resetCurrentNodeFolder = false;
}
});
QTimer::singleShot(0, this, SLOT(updateFromFocusResetFolderSingleShot()));
}
void ProjectTree::filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &list)
......@@ -306,12 +301,7 @@ void ProjectTree::filesAboutToBeRemoved(FolderNode *, const QList<FileNode*> &li
void ProjectTree::filesRemoved()
{
QTimer::singleShot(0, [this]() {
if (m_resetCurrentNodeFile) {
updateFromFocus(true);
m_resetCurrentNodeFile = false;
}
});
QTimer::singleShot(0, this, SLOT(updateFromFocusResetFileSingleShot()));
}
void ProjectTree::aboutToRemoveProject(Project *project)
......@@ -322,20 +312,12 @@ void ProjectTree::aboutToRemoveProject(Project *project)
void ProjectTree::projectRemoved()
{
QTimer::singleShot(0, [this]() {
updateFromFocus(true);
m_resetCurrentNodeProject = false;
});
QTimer::singleShot(0, this, SLOT(updateFromFocusResetProjectSingleShot()));
}
void ProjectTree::nodesAdded()
{
QTimer::singleShot(0, [this]() {
if (Utils::anyOf(m_projectTreeWidgets, &ProjectTreeWidget::hasFocus))
return;
updateFromDocumentManager();
});
QTimer::singleShot(0, this, SLOT(updateFromDocumentManagerSingleShot()));
}
void ProjectTree::updateExternalFileWarning()
......@@ -374,3 +356,32 @@ bool ProjectTree::hasFocus(ProjectTreeWidget *widget)
{
return widget && widget->focusWidget() && widget->focusWidget()->hasFocus();
}
void ProjectTree::updateFromFocusResetFileSingleShot()
{
if (m_resetCurrentNodeFile) {
updateFromFocus(true);
m_resetCurrentNodeFile = false;
}
}
void ProjectTree::updateFromFocusResetFolderSingleShot()
{
if (m_resetCurrentNodeFolder) {
updateFromFocus(true);
m_resetCurrentNodeFolder = false;
}
}
void ProjectTree::updateFromFocusResetProjectSingleShot()
{
updateFromFocus(true);
m_resetCurrentNodeProject = false;
}
void ProjectTree::updateFromDocumentManagerSingleShot()
{
if (Utils::anyOf(m_projectTreeWidgets, &ProjectTreeWidget::hasFocus))
return;
updateFromDocumentManager();
}
......@@ -90,7 +90,13 @@ private:
void updateExternalFileWarning();
static bool hasFocus(Internal::ProjectTreeWidget *widget);
private slots: // use lambdas for the following when minimum Qt is 5.4
void updateFromFocusResetFileSingleShot();
void updateFromFocusResetFolderSingleShot();
void updateFromFocusResetProjectSingleShot();
void updateFromDocumentManagerSingleShot();
private:
static ProjectTree *s_instance;
QList<Internal::ProjectTreeWidget *> m_projectTreeWidgets;
Node *m_currentNode;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment