forked from qt-creator/qt-creator
Fix crash in the project mode.
Reviewed-By: con
This commit is contained in:
@@ -57,7 +57,8 @@ namespace {
|
|||||||
bool debug = false;
|
bool debug = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectWindow::ProjectWindow(QWidget *parent) : QWidget(parent)
|
ProjectWindow::ProjectWindow(QWidget *parent)
|
||||||
|
: QWidget(parent), m_currentItemChanged(false)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Project Explorer"));
|
setWindowTitle(tr("Project Explorer"));
|
||||||
setWindowIcon(QIcon(":/projectexplorer/images/projectexplorer.png"));
|
setWindowIcon(QIcon(":/projectexplorer/images/projectexplorer.png"));
|
||||||
@@ -253,16 +254,20 @@ Project *ProjectWindow::findProject(const QString &path) const
|
|||||||
|
|
||||||
void ProjectWindow::handleCurrentItemChanged(QTreeWidgetItem *current)
|
void ProjectWindow::handleCurrentItemChanged(QTreeWidgetItem *current)
|
||||||
{
|
{
|
||||||
|
if (m_currentItemChanged)
|
||||||
|
return;
|
||||||
|
m_currentItemChanged = true;
|
||||||
if (current) {
|
if (current) {
|
||||||
QString path = current->data(2, Qt::UserRole).toString();
|
QString path = current->data(2, Qt::UserRole).toString();
|
||||||
if (Project *project = findProject(path)) {
|
if (Project *project = findProject(path)) {
|
||||||
m_projectExplorer->setCurrentFile(project, path);
|
m_projectExplorer->setCurrentFile(project, path);
|
||||||
showProperties(project, QModelIndex());
|
showProperties(project, QModelIndex());
|
||||||
|
m_currentItemChanged = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
showProperties(0, QModelIndex());
|
|
||||||
}
|
}
|
||||||
|
showProperties(0, QModelIndex());
|
||||||
|
m_currentItemChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ private:
|
|||||||
QList<PropertiesPanel*> m_panels;
|
QList<PropertiesPanel*> m_panels;
|
||||||
|
|
||||||
Project *findProject(const QString &path) const;
|
Project *findProject(const QString &path) const;
|
||||||
|
bool m_currentItemChanged;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user