diff options
author | Samuel Gaist <samuel.gaist@edeltech.ch> | 2013-10-17 14:10:46 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-17 15:58:32 +0200 |
commit | b329c8ffb960da492d90c7bf70ed93f23fa2d400 (patch) | |
tree | f9672c8613bca4464c678ae42d06e6d35436d5ac /src/widgets/itemviews/qlistview.cpp | |
parent | c3bf3bd8b74187b44ec91582e1cf2be546a73349 (diff) |
Move the viewOptions code back to public implementation
The code generating the QStyleOptionViewItem has been moved back to the
public implementation and the private QAbstractItemView::viewOptions
calling it (like the Qt 4 implementation does). This makes the item
views behave properly again e.g. QListView drag & drop in Icon mode
gets the correct options to draw the moving items
Task-number: QTBUG-1180
Change-Id: I068861e1485252f12d73f9acaf12933d0ec84e2c
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/widgets/itemviews/qlistview.cpp')
-rw-r--r-- | src/widgets/itemviews/qlistview.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 43632c5fa9..8785348d2b 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -901,20 +901,14 @@ void QListView::startDrag(Qt::DropActions supportedActions) QStyleOptionViewItem QListView::viewOptions() const { Q_D(const QListView); - return d->viewOptions(); -} - -QStyleOptionViewItem QListViewPrivate::viewOptions() const -{ - Q_Q(const QListView); - QStyleOptionViewItem option = QAbstractItemViewPrivate::viewOptions(); - if (!iconSize.isValid()) { // otherwise it was already set in abstractitemview - int pm = (viewMode == QListView::ListMode - ? q->style()->pixelMetric(QStyle::PM_ListViewIconSize, 0, q) - : q->style()->pixelMetric(QStyle::PM_IconViewIconSize, 0, q)); + QStyleOptionViewItem option = QAbstractItemView::viewOptions(); + if (!d->iconSize.isValid()) { // otherwise it was already set in abstractitemview + int pm = (d->viewMode == QListView::ListMode + ? style()->pixelMetric(QStyle::PM_ListViewIconSize, 0, this) + : style()->pixelMetric(QStyle::PM_IconViewIconSize, 0, this)); option.decorationSize = QSize(pm, pm); } - if (viewMode == QListView::IconMode) { + if (d->viewMode == QListView::IconMode) { option.showDecorationSelected = false; option.decorationPosition = QStyleOptionViewItem::Top; option.displayAlignment = Qt::AlignCenter; |