Skip to content

Commit 0d18154

Browse files
committed
Utilizes QSignalBlocker, refactors selection logic
1 parent c5b6987 commit 0d18154

File tree

5 files changed

+110
-84
lines changed

5 files changed

+110
-84
lines changed

ui/gpu_timing_tab_view.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ int GpuTimingTabView::EventIndexToRow(const QModelIndex &model_index)
141141
//--------------------------------------------------------------------------------------------------
142142
void GpuTimingTabView::OnEventSelectionChanged(const QModelIndex &model_index)
143143
{
144+
QItemSelectionModel *selection_model = m_table_view->selectionModel();
145+
QSignalBlocker blocker(selection_model);
144146
// Verify that the number of rows in the model is consistent with the rows of
145147
// m_timed_event_indices
146148
if (m_model.rowCount() != static_cast<int>(m_timed_event_indices.size()))
@@ -158,6 +160,8 @@ void GpuTimingTabView::OnEventSelectionChanged(const QModelIndex &model_index)
158160
return;
159161
}
160162
m_table_view->selectRow(row);
163+
m_table_view->update();
164+
m_table_view->viewport()->update();
161165
}
162166

163167
//--------------------------------------------------------------------------------------------------
@@ -166,7 +170,7 @@ void GpuTimingTabView::OnSelectionChanged(const QModelIndex &index)
166170
// Resize columns to fit the content
167171
ResizeColumns();
168172
int selected_row = index.row();
169-
if (static_cast<size_t>(selected_row) < m_timed_event_indices.size())
173+
if (static_cast<size_t>(selected_row) < m_timed_event_indices.size() && selected_row >= 0)
170174
{
171175
emit GpuTimingDataSelected(m_timed_event_indices.at(selected_row));
172176
}

0 commit comments

Comments
 (0)