QHeaderView derivative that allows selective disabling of sorting.
More...
#include <SemiSortableHeader.h>
|
| | SemiSortableHeader (Qt::Orientation ori, QWidget *parent=nullptr) |
| | Construct the header with the given orientation.
|
| void | attachTo (QTableWidget *table) |
| | Attach this header to a QTableWidget and initialize sorting state.
|
| void | setNonSortableColumns (const QSet< int > &cols) |
| | Set the set of non-sortable columns.
|
|
void | addNonSortableColumn (int col) |
| | Mark a specific column as non-sortable.
|
|
void | removeNonSortableColumn (int col) |
| | Remove non-sortable marking from a column.
|
| bool | isSortableColumn (int col) const |
| | Check whether a column is sortable.
|
|
|
void | paintSection (QPainter *painter, const QRect &rect, int logicalIndex) const override |
| | Custom painting to avoid drawing sort indicators for non-sortable columns.
|
|
void | mousePressEvent (QMouseEvent *e) override |
| | Intercept mouse presses to ignore clicks on non-sortable columns.
|
QHeaderView derivative that allows selective disabling of sorting.
The header can be attached to a QTableWidget and configured with a set of non-sortable columns. Clicks on non-sortable columns are ignored and the header is painted without a sort indicator for those columns.
◆ SemiSortableHeader()
| SemiSortableHeader::SemiSortableHeader |
( |
Qt::Orientation | ori, |
|
|
QWidget * | parent = nullptr ) |
|
inlineexplicit |
Construct the header with the given orientation.
- Parameters
-
| ori | Header orientation (Horizontal/Vertical). |
| parent | Optional parent widget. |
◆ attachTo()
| void SemiSortableHeader::attachTo |
( |
QTableWidget * | table | ) |
|
|
inline |
Attach this header to a QTableWidget and initialize sorting state.
- Parameters
-
| table | Target table to attach to. |
◆ isSortableColumn()
| bool SemiSortableHeader::isSortableColumn |
( |
int | col | ) |
const |
|
inline |
Check whether a column is sortable.
- Returns
- true if the column is sortable.
◆ setNonSortableColumns()
| void SemiSortableHeader::setNonSortableColumns |
( |
const QSet< int > & | cols | ) |
|
|
inline |
Set the set of non-sortable columns.
- Parameters
-
| cols | Set of column indexes that should not be sortable. |
The documentation for this class was generated from the following file: