How to keep header from being selected when there is one item in a QTableWidget?

I can't seem to keep the horizontal header from being selected when I select a single row in a QTableWidget.

Example:

alt text

How can I prevent the header from being selected too? This only happens when one row is in the table. If it has more than two rows, then it works as expected and only the row itself is selected.


Note: I have set

ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);

so that the entire row is selected when the user clicks a cell.

7
задан Nathan Osman 23 August 2010 в 01:16
поделиться

1 ответ

Я создал тест и наблюдал такое же поведение, но не уверен, каково предполагаемое поведение. Мне удалось предотвратить это, установив для horizontalHeaderHighlightSections значение false, но я не уверен, что это оптимальное решение.

6
ответ дан 7 December 2019 в 01:14
поделиться
Другие вопросы по тегам:

Похожие вопросы: