fix: [session] The default session can be deleted and renamed

When opening the session manager for the first time, the default session can be deleted and renamed.

The default session is selected during construction, and the active session is selected in the showEvent.
If the active session is the default session, the selectionChanged signal won't be triggered, which leads to the default session being able to be deleted and renamed.

Change-Id: I2186d02e93bcd3243f3ccf76645c19224f3d32db
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Liu Zhangjian
2024-11-19 15:18:08 +08:00
parent df4ab488ff
commit 5d0331c5ca

View File

@@ -50,11 +50,6 @@ SessionView::SessionView(QWidget *parent)
// Ensure that the full session name is visible.
header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
QItemSelection firstRow(m_sessionModel.index(0,0), m_sessionModel.index(
0, m_sessionModel.columnCount() - 1));
selectionModel()->select(firstRow, QItemSelectionModel::QItemSelectionModel::
SelectCurrent);
connect(this, &Utils::TreeView::activated, this, [this](const QModelIndex &index){
emit sessionActivated(m_sessionModel.sessionAt(index.row()));
});