diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-02 14:25:19 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-11-02 14:54:47 (GMT) |
commit | 11dea4a8b227801c110f791f350632bf6f0c958d (patch) | |
tree | 246eeda8b829c4c0e66e40348b520c33559bcd80 /src/gui/itemviews | |
parent | 8abe466caa1b38f4cc1f95fba83d5e61e611e931 (diff) | |
download | Qt-11dea4a8b227801c110f791f350632bf6f0c958d.zip Qt-11dea4a8b227801c110f791f350632bf6f0c958d.tar.gz Qt-11dea4a8b227801c110f791f350632bf6f0c958d.tar.bz2 |
Fixed spacing display in QListView with wrapped text.
The spacing was not being substracted from the viewport width when calculating
the available space for items. Auto-test included.
Reviewed-by: Olivier
Task-number: QTBUG-2678
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index d680af8..15db9a6 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -357,7 +357,7 @@ QListView::LayoutMode QListView::layoutMode() const /*! \property QListView::spacing - \brief the space between items in the layout + \brief the space around the items in the layout This property is the size of the empty space that is padded around an item in the layout. @@ -972,9 +972,9 @@ void QListView::paintEvent(QPaintEvent *e) option.rect = visualRect(*it); if (flow() == TopToBottom) - option.rect.setWidth(qMin(viewport()->size().width(), option.rect.width())); + option.rect.setWidth(qMin(viewport()->size().width() - 2 * d->spacing(), option.rect.width())); else - option.rect.setHeight(qMin(viewport()->size().height(), option.rect.height())); + option.rect.setHeight(qMin(viewport()->size().height() - 2 * d->spacing(), option.rect.height())); option.state = state; if (selections && selections->isSelected(*it)) @@ -1837,14 +1837,14 @@ void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) { horizontalScrollBar()->setSingleStep(step.width() + spacing()); horizontalScrollBar()->setPageStep(viewport()->width()); - horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width()); + horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width() - 2 * spacing()); } void QCommonListViewBase::updateVerticalScrollBar(const QSize &step) { verticalScrollBar()->setSingleStep(step.height() + spacing()); verticalScrollBar()->setPageStep(viewport()->height()); - verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height()); + verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height() - 2 * spacing()); } void QCommonListViewBase::scrollContentsBy(int dx, int dy, bool /*scrollElasticBand*/) |