summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-03-02 08:14:54 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-03-03 08:34:19 +0000
commit863debd720e25d27fde845c248806df3025133fb (patch)
tree67f04f8231a185256ce8f9b710c35b106f003dfa /src/widgets/itemviews
parent0cd15fd94de4c688f67049b1fef17b6ca698bf67 (diff)
Revert "Add expandingListItems property to QListView"
This reverts commit a4c25c020554527aa9ff9b533afabffef46be131. The API is too limited in scope, and a good name is hard to find, as evidenced in the API review discussion preceding Qt 5.9 beta. This API will hopefully return as something like setItemAlignment(). [ChangeLog][QtWidgets][QListView] EDIT: REMOVE: Added expandingListItems property. Conflicts: tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp Change-Id: I397acd8a7a6c716e2d3c96eee45a276eb6d4f9dd Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
Diffstat (limited to 'src/widgets/itemviews')
-rw-r--r--src/widgets/itemviews/qlistview.cpp44
-rw-r--r--src/widgets/itemviews/qlistview.h4
-rw-r--r--src/widgets/itemviews/qlistview_p.h2
3 files changed, 4 insertions, 46 deletions
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 1414823e82..653b03ef0d 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1625,33 +1625,6 @@ bool QListView::isSelectionRectVisible() const
}
/*!
- \property QListView::expandingListItems
- \brief if items occupy the entire width of the column
- \since 5.9
-
- If this property is \c true then all items in the column
- will have the width of the column; otherwise the width of
- each item will be determined by it's size hint.
-
- By default, this property is \c true.
-*/
-void QListView::setExpandingListItems(bool enable)
-{
- Q_D(QListView);
- if (d->expandingListItems == enable)
- return;
- d->expandingListItems = enable;
- if (viewMode() == ListMode && flow() == QListView::TopToBottom && isWrapping())
- d->doDelayedItemsLayout();
-}
-
-bool QListView::isExpandingListItems() const
-{
- Q_D(const QListView);
- return d->expandingListItems;
-}
-
-/*!
\reimp
*/
bool QListView::event(QEvent *e)
@@ -1677,8 +1650,7 @@ QListViewPrivate::QListViewPrivate()
column(0),
uniformItemSizes(false),
batchSize(100),
- showElasticBand(false),
- expandingListItems(true)
+ showElasticBand(false)
{
}
@@ -2395,8 +2367,7 @@ QListViewItem QListModeViewBase::indexToListViewItem(const QModelIndex &index) c
int right = (segment + 1 >= segmentPositions.count()
? contentsSize.width()
: segmentPositions.at(segment + 1));
- size.setWidth(dd->expandingListItems ? right - pos.x()
- : qMin(size.width(), right - pos.x()));
+ size.setWidth(right - pos.x());
} else { // make the items as wide as the viewport
size.setWidth(qMax(size.width(), viewport()->width() - 2 * spacing()));
}
@@ -2580,15 +2551,8 @@ QVector<QModelIndex> QListModeViewBase::intersectingSet(const QRect &area) const
if (isHidden(row))
continue;
QModelIndex index = modelIndex(row);
- if (index.isValid()) {
- if (flow() == QListView::LeftToRight || dd->expandingListItems) {
- ret += index;
- } else {
- const int iw = indexToListViewItem(index).width(); // item width
- if (iw > 0 && segStartPosition - segmentPositions.at(seg) < iw)
- ret += index;
- }
- }
+ if (index.isValid())
+ ret += index;
#if 0 // for debugging
else
qWarning("intersectingSet: row %d was invalid", row);
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index 4cf53f9bab..e918e66d38 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -66,7 +66,6 @@ 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(bool expandingListItems READ isExpandingListItems WRITE setExpandingListItems)
public:
enum Movement { Static, Free, Snap };
@@ -127,9 +126,6 @@ public:
void setSelectionRectVisible(bool show);
bool isSelectionRectVisible() const;
- void setExpandingListItems(bool enable);
- bool isExpandingListItems() const;
-
QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index a66e007195..47effcdfd9 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -431,8 +431,6 @@ public:
QRect elasticBand;
bool showElasticBand;
-
- bool expandingListItems;
};
// inline implementations