diff options
| author | Tom Lin <[email protected]> | 2022-01-16 14:01:32 +0000 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2022-01-16 14:01:32 +0000 |
| commit | d3839617193e92463806580699caa595c892b8a6 (patch) | |
| tree | 9819ace996bc994dd047206669eaa2869471a79b /src/kitemviews/private/kitemlistheaderwidget.h | |
| parent | a286506405550fe299e1f4a5fd73543e642655a0 (diff) | |
Full row highlight implementation
This commit implements full-row selection and hover highlights for the
details view mode.
This commit also contains fixes for 444680, 444753, both uncovered
during this change.
BUG: 181438
BUG: 444680
BUG: 444753
FIXED-IN: 22.04
Diffstat (limited to 'src/kitemviews/private/kitemlistheaderwidget.h')
| -rw-r--r-- | src/kitemviews/private/kitemlistheaderwidget.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/kitemviews/private/kitemlistheaderwidget.h b/src/kitemviews/private/kitemlistheaderwidget.h index 44adc23c5..58f0dc98e 100644 --- a/src/kitemviews/private/kitemlistheaderwidget.h +++ b/src/kitemviews/private/kitemlistheaderwidget.h @@ -50,6 +50,9 @@ public: void setOffset(qreal offset); qreal offset() const; + void setLeadingPadding(qreal width); + qreal leadingPadding() const; + qreal minimumColumnWidth() const; void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = nullptr) override; @@ -63,6 +66,8 @@ Q_SIGNALS: qreal currentWidth, qreal previousWidth); + void leadingPaddingChanged(qreal width); + /** * Is emitted if the user has released the mouse button after adjusting the * width of a visible role. @@ -105,6 +110,13 @@ private Q_SLOTS: void slotSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous); private: + + enum PaddingGrip + { + Leading, + Trailing, + }; + void paintRole(QPainter* painter, const QByteArray& role, const QRectF& rect, @@ -115,6 +127,7 @@ private: void updateHoveredRoleIndex(const QPointF& pos); int roleIndexAt(const QPointF& pos) const; bool isAboveRoleGrip(const QPointF& pos, int roleIndex) const; + bool isAbovePaddingGrip(const QPointF& pos, PaddingGrip paddingGrip) const; /** * Creates a pixmap of the role with the index \a roleIndex that is shown @@ -138,12 +151,14 @@ private: { NoRoleOperation, ResizeRoleOperation, + ResizeLeadingColumnOperation, MoveRoleOperation }; bool m_automaticColumnResizing; KItemModelBase* m_model; qreal m_offset; + qreal m_leadingPadding; QList<QByteArray> m_columns; QHash<QByteArray, qreal> m_columnWidths; QHash<QByteArray, qreal> m_preferredColumnWidths; |
