summaryrefslogtreecommitdiffstats
path: root/src/widgets/itemviews/qabstractitemview.cpp
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2013-10-17 14:10:46 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-17 15:58:32 +0200
commitb329c8ffb960da492d90c7bf70ed93f23fa2d400 (patch)
treef9672c8613bca4464c678ae42d06e6d35436d5ac /src/widgets/itemviews/qabstractitemview.cpp
parentc3bf3bd8b74187b44ec91582e1cf2be546a73349 (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/qabstractitemview.cpp')
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 35ba1ed74e..d3e6b7ab52 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -3600,45 +3600,45 @@ void QAbstractItemView::startDrag(Qt::DropActions supportedActions)
QStyleOptionViewItem QAbstractItemView::viewOptions() const
{
Q_D(const QAbstractItemView);
- return d->viewOptions();
-}
-
-QStyleOptionViewItem QAbstractItemViewPrivate::viewOptions() const
-{
- Q_Q(const QAbstractItemView);
QStyleOptionViewItem option;
- option.init(q);
+ option.init(this);
option.state &= ~QStyle::State_MouseOver;
- option.font = q->font();
+ option.font = font();
#ifndef Q_WS_MAC
// On mac the focus appearance follows window activation
// not widget activation
- if (!q->hasFocus())
+ if (!hasFocus())
option.state &= ~QStyle::State_Active;
#endif
option.state &= ~QStyle::State_HasFocus;
- if (iconSize.isValid()) {
- option.decorationSize = iconSize;
+ if (d->iconSize.isValid()) {
+ option.decorationSize = d->iconSize;
} else {
- int pm = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q);
+ int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
option.decorationSize = QSize(pm, pm);
}
option.decorationPosition = QStyleOptionViewItem::Left;
option.decorationAlignment = Qt::AlignCenter;
option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter;
- option.textElideMode = textElideMode;
+ option.textElideMode = d->textElideMode;
option.rect = QRect();
- option.showDecorationSelected = q->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, q);
- if (wrapItemText)
+ option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, this);
+ if (d->wrapItemText)
option.features = QStyleOptionViewItem::WrapText;
- option.locale = q->locale();
+ option.locale = locale();
option.locale.setNumberOptions(QLocale::OmitGroupSeparator);
- option.widget = q;
+ option.widget = this;
return option;
}
+QStyleOptionViewItem QAbstractItemViewPrivate::viewOptions() const
+{
+ Q_Q(const QAbstractItemView);
+ return q->viewOptions();
+}
+
/*!
Returns the item view's state.