CSelectInstanceDialog: Pass QModelIndex by const reference

Gets rid of a few trivial 24 byte copies.
This commit is contained in:
Lioncache
2025-12-07 08:08:04 -05:00
parent 6428864373
commit e7a2a10d64
2 changed files with 7 additions and 8 deletions

View File

@@ -60,20 +60,19 @@ void CSelectInstanceDialog::OnTabChanged(int NewTabIndex)
ui->ButtonBox->button(QDialogButtonBox::Ok)->setEnabled(mValidSelection);
}
void CSelectInstanceDialog::OnTreeClicked(QModelIndex Index)
void CSelectInstanceDialog::OnTreeClicked(const QModelIndex& Index)
{
int TabIndex = ui->TabWidget->currentIndex();
const int TabIndex = ui->TabWidget->currentIndex();
if (TabIndex == 0)
{
QModelIndex SourceIndex = mLayersProxyModel.mapToSource(Index);
const QModelIndex SourceIndex = mLayersProxyModel.mapToSource(Index);
mpLayersInst = mLayersModel.IndexObject(SourceIndex);
mValidSelection = (mpLayersInst != nullptr);
}
else
{
QModelIndex SourceIndex = mTypesProxyModel.mapToSource(Index);
const QModelIndex SourceIndex = mTypesProxyModel.mapToSource(Index);
mpTypesInst = mTypesModel.IndexObject(SourceIndex);
mValidSelection = (mpTypesInst != nullptr);
}
@@ -81,7 +80,7 @@ void CSelectInstanceDialog::OnTreeClicked(QModelIndex Index)
ui->ButtonBox->button(QDialogButtonBox::Ok)->setEnabled(mValidSelection);
}
void CSelectInstanceDialog::OnTreeDoubleClicked(QModelIndex /*Index*/)
void CSelectInstanceDialog::OnTreeDoubleClicked(const QModelIndex& /*Index*/)
{
// Instance selection was handled in OnTreeClicked on the first click.
if (mValidSelection)

View File

@@ -36,8 +36,8 @@ public:
public slots:
void OnTabChanged(int NewTabIndex);
void OnTreeClicked(QModelIndex Index);
void OnTreeDoubleClicked(QModelIndex Index);
void OnTreeClicked(const QModelIndex& Index);
void OnTreeDoubleClicked(const QModelIndex& Index);
};
#endif // CSELECTINSTANCEDIALOG_H