forked from qt-creator/qt-creator
StudioWelcome: Avoid opening two projects on double click
This issue was introdced because we do not go to the edit mode after opening a project. We stay in the WelcomeMode until the project is loaded. Since the recent project list did change a second click (aka double click) will open a second project. We now block the update of the model for 1000ms and also block opening another project for the same duration. Task-number: QDS-6286 Change-Id: I52ed6aa3686594b63fe4a6134c6db1287bca1dcb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -224,9 +224,15 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE void openProjectAt(int row)
|
Q_INVOKABLE void openProjectAt(int row)
|
||||||
{
|
{
|
||||||
|
if (m_blockOpenRecent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_blockOpenRecent = true;
|
||||||
const QString projectFile = data(index(row, 0), ProjectModel::FilePathRole).toString();
|
const QString projectFile = data(index(row, 0), ProjectModel::FilePathRole).toString();
|
||||||
if (QFileInfo::exists(projectFile))
|
if (QFileInfo::exists(projectFile))
|
||||||
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile);
|
ProjectExplorer::ProjectExplorerPlugin::openProjectWelcomePage(projectFile);
|
||||||
|
|
||||||
|
resetProjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_INVOKABLE int get(int) { return -1; }
|
Q_INVOKABLE int get(int) { return -1; }
|
||||||
@@ -311,6 +317,7 @@ private:
|
|||||||
|
|
||||||
bool m_communityVersion = true;
|
bool m_communityVersion = true;
|
||||||
bool m_enterpriseVersion = false;
|
bool m_enterpriseVersion = false;
|
||||||
|
bool m_blockOpenRecent = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
void ProjectModel::setupVersion()
|
void ProjectModel::setupVersion()
|
||||||
@@ -520,8 +527,11 @@ QHash<int, QByteArray> ProjectModel::roleNames() const
|
|||||||
|
|
||||||
void ProjectModel::resetProjects()
|
void ProjectModel::resetProjects()
|
||||||
{
|
{
|
||||||
|
QTimer::singleShot(2000, this, [this]() {
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
endResetModel();
|
endResetModel();
|
||||||
|
m_blockOpenRecent = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class WelcomeMode : public Core::IMode
|
class WelcomeMode : public Core::IMode
|
||||||
|
Reference in New Issue
Block a user