diff options
author | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-07-13 16:34:32 -0700 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@qt.io> | 2017-07-13 16:36:10 -0700 |
commit | d38fe875c7850ca2c6ca28f91e94ae276735fac8 (patch) | |
tree | e5c92cef74e0853490d77cf0139b23f00d548a6e /src/widgets/itemviews/qlistview.cpp | |
parent | ac4e848c9802377b7c4ff673180f28b9ca76b746 (diff) | |
parent | 627f0a7f7d775ecd263b95dd07fca44bfcb0c5cf (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/widgets/widgets/qmainwindowlayout.cpp
Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
Diffstat (limited to 'src/widgets/itemviews/qlistview.cpp')
-rw-r--r-- | src/widgets/itemviews/qlistview.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index bc0ca7dc1c..e234bae4dd 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -50,7 +50,9 @@ #include <qstyle.h> #include <qevent.h> #include <qscrollbar.h> +#if QT_CONFIG(rubberband) #include <qrubberband.h> +#endif #include <private/qlistview_p.h> #include <private/qscrollbar_p.h> #include <qdebug.h> @@ -1042,7 +1044,7 @@ void QListView::paintEvent(QPaintEvent *e) d->commonListView->paintDragDrop(&painter); #endif -#ifndef QT_NO_RUBBERBAND +#if QT_CONFIG(rubberband) // #### move this implementation into a dynamic class if (d->showElasticBand && d->elasticBand.isValid()) { QStyleOptionRubberBand opt; @@ -1870,6 +1872,11 @@ void QCommonListViewBase::paintDragDrop(QPainter *painter) } #endif +QSize QListModeViewBase::viewportSize(const QAbstractItemView *v) +{ + return v->contentsRect().marginsRemoved(v->viewportMargins()).size(); +} + void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) { horizontalScrollBar()->d_func()->itemviewChangeSingleStep(step.width() + spacing()); @@ -1882,7 +1889,7 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded && qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded; - const QSize viewportSize = qq->contentsRect().size(); + const QSize viewportSize = QListModeViewBase::viewportSize(qq); bool verticalWantsToShow = contentsSize.height() > viewportSize.height(); bool horizontalWantsToShow; @@ -1912,7 +1919,7 @@ void QCommonListViewBase::updateVerticalScrollBar(const QSize &step) const bool bothScrollBarsAuto = qq->verticalScrollBarPolicy() == Qt::ScrollBarAsNeeded && qq->horizontalScrollBarPolicy() == Qt::ScrollBarAsNeeded; - const QSize viewportSize = qq->contentsRect().size(); + const QSize viewportSize = QListModeViewBase::viewportSize(qq); bool horizontalWantsToShow = contentsSize.width() > viewportSize.width(); bool verticalWantsToShow; |