summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qlistview.h
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2016-10-18 16:35:16 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2018-06-08 12:35:15 +0000
commit649490f359bc7308a0e21f0b38cf9b8a01e7b619 (patch)
tree7335b3d8236424c4c5de2d810bf955a2b30ed0d3 /src/widgets/itemviews/qlistview.h
parent6c566e506b7316b3495fe73b5f7ee4dc8902c9d2 (diff)
Add itemAlignment property to QListView
This property allows to change the default behavior in which list items occupy the entire width of their column. Setting it to Qt::{AlignLeft,AlignRight,AlignHCenter} will reduce their widths to the minimum values, thus allowing to have intermediate free space. Then the user will be able to begin selections by mouse from this space. [ChangeLog][QtWidgets][QListView] Added itemAlignment property. Task-number: QTBUG-56606 Change-Id: Iae55c251379be4e45d0c0d69175ff4388b5785b4 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/itemviews/qlistview.h')
-rw-r--r--src/widgets/itemviews/qlistview.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index 9fc4035999..8a5d5e02ae 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -65,6 +65,7 @@ class Q_WIDGETS_EXPORT QListView : public QAbstractItemView
Q_PROPERTY(int batchSize READ batchSize WRITE setBatchSize)
Q_PROPERTY(bool wordWrap READ wordWrap WRITE setWordWrap)
Q_PROPERTY(bool selectionRectVisible READ isSelectionRectVisible WRITE setSelectionRectVisible)
+ Q_PROPERTY(Qt::Alignment itemAlignment READ itemAlignment WRITE setItemAlignment)
public:
enum Movement { Static, Free, Snap };
@@ -125,6 +126,9 @@ public:
void setSelectionRectVisible(bool show);
bool isSelectionRectVisible() const;
+ void setItemAlignment(Qt::Alignment alignment);
+ Qt::Alignment itemAlignment() const;
+
QRect visualRect(const QModelIndex &index) const override;
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
QModelIndex indexAt(const QPoint &p) const override;