forked from qt-creator/qt-creator
ProjectExplorer: Let the user delete sessions via the "Delete" key
Task-number: QTCREATORBUG-17668 Change-Id: Id827be147627a54953e6495be503c97b31232cf3 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -141,5 +141,16 @@ void SessionView::showEvent(QShowEvent *event)
|
|||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SessionView::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if (event->key() != Qt::Key_Delete) {
|
||||||
|
TreeView::keyPressEvent(event);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const QString session = currentSession();
|
||||||
|
if (!session.isEmpty() && session != "default" && session != SessionManager::activeSession())
|
||||||
|
deleteCurrentSession();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
@@ -51,15 +51,15 @@ public:
|
|||||||
void selectActiveSession();
|
void selectActiveSession();
|
||||||
void selectSession(const QString &sessionName);
|
void selectSession(const QString &sessionName);
|
||||||
|
|
||||||
protected:
|
|
||||||
void showEvent(QShowEvent* event) override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void activated(const QString &session);
|
void activated(const QString &session);
|
||||||
void selected(const QString &session);
|
void selected(const QString &session);
|
||||||
void sessionSwitched();
|
void sessionSwitched();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void showEvent(QShowEvent* event) override;
|
||||||
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
SessionModel m_sessionModel;
|
SessionModel m_sessionModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user