From 02a77600e50cbb7eb9f833d7eaa30b4b0efb47a4 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Mon, 5 Feb 2024 18:45:12 +0100 Subject: [PATCH] QHeaderView: make sectionsMovable/sectionsClickable properties When those two attributes were added in Qt5 they were not marked as property for unknown reason. Therefore propagate them now. Fixes: QTBUG-1639 Change-Id: If9f0def2eb680c9c9e8a04b101768d87885d542b Reviewed-by: David Faure --- src/widgets/itemviews/qheaderview.cpp | 42 ++++++++++----------------- src/widgets/itemviews/qheaderview.h | 2 ++ 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index c7da20068c..2bc6a84f37 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -1056,19 +1056,22 @@ int QHeaderView::logicalIndex(int visualIndex) const } /*! - \since 5.0 + \property QHeaderView::sectionsMovable - If \a movable is true, the header sections may be moved by the user; + If \a sectionsMovable is true, the header sections may be moved by the user; otherwise they are fixed in place. When used in combination with QTreeView, the first column is not movable (since it contains the tree structure), by default. You can make it movable with setFirstSectionMovable(true). - \sa sectionsMovable(), sectionMoved() + \sa sectionMoved() \sa setFirstSectionMovable() */ +/*! + Sets \l sectionsMovable to \a movable. + */ void QHeaderView::setSectionsMovable(bool movable) { Q_D(QHeaderView); @@ -1076,17 +1079,8 @@ void QHeaderView::setSectionsMovable(bool movable) } /*! - \since 5.0 - - Returns \c true if the header can be moved by the user; otherwise returns - false. - - By default, sections are movable in QTreeView (except for the first one), - and not movable in QTableView. - - \sa setSectionsMovable() + Returns \l sectionsMovable. */ - bool QHeaderView::sectionsMovable() const { Q_D(const QHeaderView); @@ -1130,14 +1124,17 @@ bool QHeaderView::isFirstSectionMovable() const } /*! - \since 5.0 + \property QHeaderView::sectionsClickable - If \a clickable is true, the header will respond to single clicks. + Holds \c true if the header is clickable; otherwise \c false. A + clickable header could be set up to allow the user to change the + representation of the data in the view related to the header. - \sa sectionsClickable(), sectionClicked(), sectionPressed(), - setSortIndicatorShown() + \sa sectionPressed(), setSortIndicatorShown() +*/ +/*! + Set \l sectionsClickable to \a clickable. */ - void QHeaderView::setSectionsClickable(bool clickable) { Q_D(QHeaderView); @@ -1145,15 +1142,8 @@ void QHeaderView::setSectionsClickable(bool clickable) } /*! - \since 5.0 - - Returns \c true if the header is clickable; otherwise returns \c false. A - clickable header could be set up to allow the user to change the - representation of the data in the view related to the header. - - \sa setSectionsClickable() + Returns \l sectionsClickable. */ - bool QHeaderView::sectionsClickable() const { Q_D(const QHeaderView); diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h index ddb34311c4..bd0050df5e 100644 --- a/src/widgets/itemviews/qheaderview.h +++ b/src/widgets/itemviews/qheaderview.h @@ -19,6 +19,8 @@ class Q_WIDGETS_EXPORT QHeaderView : public QAbstractItemView Q_OBJECT Q_PROPERTY(bool firstSectionMovable READ isFirstSectionMovable WRITE setFirstSectionMovable) Q_PROPERTY(bool showSortIndicator READ isSortIndicatorShown WRITE setSortIndicatorShown) + Q_PROPERTY(bool sectionsMovable READ sectionsMovable WRITE setSectionsMovable) + Q_PROPERTY(bool sectionsClickable READ sectionsClickable WRITE setSectionsClickable) Q_PROPERTY(bool highlightSections READ highlightSections WRITE setHighlightSections) Q_PROPERTY(bool stretchLastSection READ stretchLastSection WRITE setStretchLastSection) Q_PROPERTY(bool cascadingSectionResizes READ cascadingSectionResizes