summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qheaderview.cpp2
-rw-r--r--src/gui/itemviews/qlistview.cpp7
-rw-r--r--src/gui/itemviews/qlistview_p.h7
-rw-r--r--src/gui/itemviews/qlistwidget.cpp4
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/gui/itemviews/qtablewidget.cpp4
-rw-r--r--src/gui/itemviews/qtreewidget.cpp5
7 files changed, 14 insertions, 17 deletions
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 633dd53..96df758 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -2615,7 +2615,7 @@ void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bot
int first = orientation() == Qt::Horizontal ? topLeft.column() : topLeft.row();
int last = orientation() == Qt::Horizontal ? bottomRight.column() : bottomRight.row();
for (int i = first; i <= last && !resizeRequired; ++i)
- resizeRequired = (resizeRequired && resizeMode(i));
+ resizeRequired = (resizeMode(i) == ResizeToContents);
if (resizeRequired)
d->doDelayedResizeSections();
}
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 1870a3b..b055d32 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1957,7 +1957,6 @@ bool QListView::event(QEvent *e)
QListViewPrivate::QListViewPrivate()
: QAbstractItemViewPrivate(),
dynamicListView(0),
- staticListView(0),
wrap(false),
space(0),
flow(QListView::TopToBottom),
@@ -1975,8 +1974,10 @@ QListViewPrivate::QListViewPrivate()
QListViewPrivate::~QListViewPrivate()
{
- delete staticListView;
- delete dynamicListView;
+ if (viewMode == QListView::ListMode)
+ delete staticListView;
+ else
+ delete dynamicListView;
}
void QListViewPrivate::clear()
diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h
index 1131059..6c8d324 100644
--- a/src/gui/itemviews/qlistview_p.h
+++ b/src/gui/itemviews/qlistview_p.h
@@ -351,9 +351,10 @@ public:
QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const;
- // ### FIXME: we only need one at a time
- QDynamicListViewBase *dynamicListView;
- QStaticListViewBase *staticListView;
+ union {
+ QDynamicListViewBase *dynamicListView;
+ QStaticListViewBase *staticListView;
+ };
// ### FIXME: see if we can move the members into the dynamic/static classes
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 2792bbd..a1f8288 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -708,9 +708,7 @@ QVariant QListWidgetItem::data(int role) const
bool QListWidgetItem::operator<(const QListWidgetItem &other) const
{
const QVariant v1 = data(Qt::DisplayRole), v2 = other.data(Qt::DisplayRole);
- if (QAbstractItemModelPrivate::canConvertToDouble(v1) && QAbstractItemModelPrivate::canConvertToDouble(v2))
- return v1.toDouble() < v2.toDouble();
- return v1.toString() < v2.toString();
+ return QAbstractItemModelPrivate::variantLessThan(v1, v2);
}
#ifndef QT_NO_DATASTREAM
diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp
index f7c7d12..a8ea218 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -270,7 +270,7 @@ QString QStyledItemDelegate::displayText(const QVariant &value, const QLocale& l
switch (value.userType()) {
case QMetaType::Float:
case QVariant::Double:
- text = locale.toString(value.toDouble());
+ text = locale.toString(value.toReal());
break;
case QVariant::Int:
case QVariant::LongLong:
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index fea81e5..de8ebde 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -1392,9 +1392,7 @@ QVariant QTableWidgetItem::data(int role) const
bool QTableWidgetItem::operator<(const QTableWidgetItem &other) const
{
const QVariant v1 = data(Qt::DisplayRole), v2 = other.data(Qt::DisplayRole);
- if (QAbstractItemModelPrivate::canConvertToDouble(v1) && QAbstractItemModelPrivate::canConvertToDouble(v2))
- return v1.toDouble() < v2.toDouble();
- return v1.toString() < v2.toString();
+ return QAbstractItemModelPrivate::variantLessThan(v1, v2);
}
#ifndef QT_NO_DATASTREAM
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 025f83c..f48e393 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -1768,6 +1768,7 @@ QVariant QTreeWidgetItem::data(int column, int role) const
// special case for check state in tristate
if (children.count() && (itemFlags & Qt::ItemIsTristate))
return childrenCheckState(column);
+ // fallthrough intended
default:
if (column >= 0 && column < values.size()) {
const QVector<QWidgetItemData> &column_values = values.at(column);
@@ -1789,9 +1790,7 @@ bool QTreeWidgetItem::operator<(const QTreeWidgetItem &other) const
int column = view ? view->sortColumn() : 0;
const QVariant v1 = data(column, Qt::DisplayRole);
const QVariant v2 = other.data(column, Qt::DisplayRole);
- if (QAbstractItemModelPrivate::canConvertToDouble(v1) && QAbstractItemModelPrivate::canConvertToDouble(v2))
- return v1.toDouble() < v2.toDouble();
- return v1.toString() < v2.toString();
+ return QAbstractItemModelPrivate::variantLessThan(v1, v2);
}
#ifndef QT_NO_DATASTREAM