Adjust DbQueryWidget selection only if empty

This commit is contained in:
Martchus 2018-08-20 21:41:17 +02:00
parent 8e59c5b24f
commit 1357fd1a32
1 changed files with 4 additions and 2 deletions

View File

@ -229,8 +229,10 @@ void DbQueryWidget::showResults()
if (m_model->results().isEmpty()) {
m_ui->applyPushButton->setEnabled(false);
} else {
m_ui->resultsTreeView->selectionModel()->setCurrentIndex(
m_model->index(0, 0), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
auto *const selectionModel(m_ui->resultsTreeView->selectionModel());
if (selectionModel->selection().isEmpty()) {
selectionModel->setCurrentIndex(m_model->index(0, 0), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
}
m_ui->applyPushButton->setEnabled(m_tagEditorWidget->activeTagEdit());
}
setStatus(true);