summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-01-29 03:47:42 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-01-29 03:47:42 (GMT)
commit350b0fadf3fbd12a278681513295577a066b0fb1 (patch)
treef0ebad6693c3cf3b7754fb8187a6b320e5d4679f /src/gui/itemviews
parente4625e53aa893f7c59407913e743951294c7dafe (diff)
parent9d636095403f5abecbdff8ffffe658f35ff10001 (diff)
downloadQt-350b0fadf3fbd12a278681513295577a066b0fb1.zip
Qt-350b0fadf3fbd12a278681513295577a066b0fb1.tar.gz
Qt-350b0fadf3fbd12a278681513295577a066b0fb1.tar.bz2
Merge commit 'origin/4.6' into bearermanagement/integration-4
Conflicts: configure src/gui/painting/qpainter.cpp src/s60installs/s60installs.pro
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qabstractitemdelegate.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemdelegate.h2
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp57
-rw-r--r--src/gui/itemviews/qabstractitemview.h2
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h3
-rw-r--r--src/gui/itemviews/qabstractproxymodel.cpp2
-rw-r--r--src/gui/itemviews/qabstractproxymodel.h2
-rw-r--r--src/gui/itemviews/qabstractproxymodel_p.h2
-rw-r--r--src/gui/itemviews/qbsptree.cpp2
-rw-r--r--src/gui/itemviews/qbsptree_p.h2
-rw-r--r--src/gui/itemviews/qcolumnview.cpp2
-rw-r--r--src/gui/itemviews/qcolumnview.h2
-rw-r--r--src/gui/itemviews/qcolumnview_p.h2
-rw-r--r--src/gui/itemviews/qcolumnviewgrip.cpp2
-rw-r--r--src/gui/itemviews/qcolumnviewgrip_p.h2
-rw-r--r--src/gui/itemviews/qdatawidgetmapper.cpp2
-rw-r--r--src/gui/itemviews/qdatawidgetmapper.h2
-rw-r--r--src/gui/itemviews/qdirmodel.cpp2
-rw-r--r--src/gui/itemviews/qdirmodel.h2
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp2
-rw-r--r--src/gui/itemviews/qfileiconprovider.h2
-rw-r--r--src/gui/itemviews/qheaderview.cpp2
-rw-r--r--src/gui/itemviews/qheaderview.h2
-rw-r--r--src/gui/itemviews/qheaderview_p.h2
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp2
-rw-r--r--src/gui/itemviews/qitemdelegate.h2
-rw-r--r--src/gui/itemviews/qitemeditorfactory.cpp2
-rw-r--r--src/gui/itemviews/qitemeditorfactory.h2
-rw-r--r--src/gui/itemviews/qitemeditorfactory_p.h2
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp2
-rw-r--r--src/gui/itemviews/qitemselectionmodel.h2
-rw-r--r--src/gui/itemviews/qitemselectionmodel_p.h2
-rw-r--r--src/gui/itemviews/qlistview.cpp9
-rw-r--r--src/gui/itemviews/qlistview.h2
-rw-r--r--src/gui/itemviews/qlistview_p.h2
-rw-r--r--src/gui/itemviews/qlistwidget.cpp7
-rw-r--r--src/gui/itemviews/qlistwidget.h2
-rw-r--r--src/gui/itemviews/qlistwidget_p.h2
-rw-r--r--src/gui/itemviews/qproxymodel.cpp2
-rw-r--r--src/gui/itemviews/qproxymodel.h2
-rw-r--r--src/gui/itemviews/qproxymodel_p.h2
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp35
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.h2
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp2
-rw-r--r--src/gui/itemviews/qstandarditemmodel.h2
-rw-r--r--src/gui/itemviews/qstandarditemmodel_p.h2
-rw-r--r--src/gui/itemviews/qstringlistmodel.cpp2
-rw-r--r--src/gui/itemviews/qstringlistmodel.h2
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/gui/itemviews/qstyleditemdelegate.h2
-rw-r--r--src/gui/itemviews/qtableview.cpp20
-rw-r--r--src/gui/itemviews/qtableview.h2
-rw-r--r--src/gui/itemviews/qtableview_p.h2
-rw-r--r--src/gui/itemviews/qtablewidget.cpp2
-rw-r--r--src/gui/itemviews/qtablewidget.h2
-rw-r--r--src/gui/itemviews/qtablewidget_p.h2
-rw-r--r--src/gui/itemviews/qtreeview.cpp23
-rw-r--r--src/gui/itemviews/qtreeview.h2
-rw-r--r--src/gui/itemviews/qtreeview_p.h2
-rw-r--r--src/gui/itemviews/qtreewidget.cpp2
-rw-r--r--src/gui/itemviews/qtreewidget.h2
-rw-r--r--src/gui/itemviews/qtreewidget_p.h2
-rw-r--r--src/gui/itemviews/qtreewidgetitemiterator.cpp2
-rw-r--r--src/gui/itemviews/qtreewidgetitemiterator.h2
-rw-r--r--src/gui/itemviews/qtreewidgetitemiterator_p.h2
-rw-r--r--src/gui/itemviews/qwidgetitemdata_p.h2
66 files changed, 176 insertions, 96 deletions
diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/gui/itemviews/qabstractitemdelegate.cpp
index 848abef..775bf7d 100644
--- a/src/gui/itemviews/qabstractitemdelegate.cpp
+++ b/src/gui/itemviews/qabstractitemdelegate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qabstractitemdelegate.h b/src/gui/itemviews/qabstractitemdelegate.h
index 44b8b82..d24ca4b 100644
--- a/src/gui/itemviews/qabstractitemdelegate.h
+++ b/src/gui/itemviews/qabstractitemdelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index ad15655..cbd9a8a 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -70,6 +70,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
itemDelegate(0),
selectionModel(0),
ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate),
+ noSelectionOnMousePress(false),
selectionMode(QAbstractItemView::ExtendedSelection),
selectionBehavior(QAbstractItemView::SelectItems),
currentlyCommittingEditor(0),
@@ -145,9 +146,16 @@ void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index)
if (hover == index)
return;
- q->update(hover); //update the old one
+ if (selectionBehavior != QAbstractItemView::SelectRows) {
+ q->update(hover); //update the old one
+ q->update(index); //update the new one
+ } else {
+ QRect oldHoverRect = q->visualRect(hover);
+ QRect newHoverRect = q->visualRect(index);
+ viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height()));
+ viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height()));
+ }
hover = index;
- q->update(hover); //update the new one
}
void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index)
@@ -1622,10 +1630,11 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event)
d->pressedIndex = index;
d->pressedModifiers = event->modifiers();
QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
+ d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate || !index.isValid();
QPoint offset = d->offset();
if ((command & QItemSelectionModel::Current) == 0)
d->pressedPosition = pos + offset;
- else if (!indexAt(d->pressedPosition).isValid())
+ else if (!indexAt(d->pressedPosition - offset).isValid())
d->pressedPosition = visualRect(currentIndex()).center() + offset;
if (edit(index, NoEditTriggers, event))
@@ -1760,9 +1769,10 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
- //in the case the user presses on no item we might decide to clear the selection
- if (d->selectionModel && !index.isValid())
- d->selectionModel->select(QModelIndex(), selectionCommand(index, event));
+ if (d->selectionModel && d->noSelectionOnMousePress) {
+ d->noSelectionOnMousePress = false;
+ d->selectionModel->select(index, selectionCommand(index, event));
+ }
setState(NoState);
@@ -2065,9 +2075,13 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event)
{
Q_D(QAbstractItemView);
QAbstractScrollArea::focusInEvent(event);
- if (selectionModel()
+
+ const QItemSelectionModel* model = selectionModel();
+ const bool currentIndexValid = currentIndex().isValid();
+
+ if (model
&& !d->currentIndexSet
- && !currentIndex().isValid()) {
+ && !currentIndexValid) {
bool autoScroll = d->autoScroll;
d->autoScroll = false;
QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index
@@ -2075,6 +2089,17 @@ void QAbstractItemView::focusInEvent(QFocusEvent *event)
selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
d->autoScroll = autoScroll;
}
+
+ if (model && currentIndexValid) {
+ if (currentIndex().flags() != Qt::ItemIsEditable)
+ setAttribute(Qt::WA_InputMethodEnabled, false);
+ else
+ setAttribute(Qt::WA_InputMethodEnabled);
+ }
+
+ if (!currentIndexValid)
+ setAttribute(Qt::WA_InputMethodEnabled, false);
+
d->viewport->update();
}
@@ -2195,7 +2220,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
// note that we don't check if the new current index is enabled because moveCursor() makes sure it is
if (command & QItemSelectionModel::Current) {
d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate);
- if (!indexAt(d->pressedPosition).isValid())
+ if (!indexAt(d->pressedPosition - d->offset()).isValid())
d->pressedPosition = visualRect(oldCurrent).center() + d->offset();
QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center());
setSelection(rect, command);
@@ -2552,7 +2577,9 @@ void QAbstractItemView::verticalScrollbarValueChanged(int value)
Q_D(QAbstractItemView);
if (verticalScrollBar()->maximum() == value && d->model->canFetchMore(d->root))
d->model->fetchMore(d->root);
- d->checkMouseMove(viewport()->mapFromGlobal(QCursor::pos()));
+ QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos());
+ if (viewport()->rect().contains(posInVp))
+ d->checkMouseMove(posInVp);
}
/*!
@@ -2563,7 +2590,9 @@ void QAbstractItemView::horizontalScrollbarValueChanged(int value)
Q_D(QAbstractItemView);
if (horizontalScrollBar()->maximum() == value && d->model->canFetchMore(d->root))
d->model->fetchMore(d->root);
- d->checkMouseMove(viewport()->mapFromGlobal(QCursor::pos()));
+ QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos());
+ if (viewport()->rect().contains(posInVp))
+ d->checkMouseMove(posInVp);
}
/*!
@@ -2863,6 +2892,8 @@ int QAbstractItemView::sizeHintForRow(int row) const
if (row < 0 || row >= d->model->rowCount() || !model())
return -1;
+ ensurePolished();
+
QStyleOptionViewItemV4 option = d->viewOptionsV4();
int height = 0;
int colCount = d->model->columnCount(d->root);
@@ -2892,6 +2923,8 @@ int QAbstractItemView::sizeHintForColumn(int column) const
if (column < 0 || column >= d->model->columnCount() || !model())
return -1;
+ ensurePolished();
+
QStyleOptionViewItemV4 option = d->viewOptionsV4();
int width = 0;
int rows = d->model->rowCount(d->root);
diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h
index ea5d259..0f86f62 100644
--- a/src/gui/itemviews/qabstractitemview.h
+++ b/src/gui/itemviews/qabstractitemview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 0b5cfbe..82fd1a6 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -347,6 +347,7 @@ public:
QMap<int, QPointer<QAbstractItemDelegate> > columnDelegates;
QPointer<QItemSelectionModel> selectionModel;
QItemSelectionModel::SelectionFlag ctrlDragSelectionFlag;
+ bool noSelectionOnMousePress;
QAbstractItemView::SelectionMode selectionMode;
QAbstractItemView::SelectionBehavior selectionBehavior;
diff --git a/src/gui/itemviews/qabstractproxymodel.cpp b/src/gui/itemviews/qabstractproxymodel.cpp
index 0b479c3..40345a7 100644
--- a/src/gui/itemviews/qabstractproxymodel.cpp
+++ b/src/gui/itemviews/qabstractproxymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qabstractproxymodel.h b/src/gui/itemviews/qabstractproxymodel.h
index 638dbb6..c6bb985 100644
--- a/src/gui/itemviews/qabstractproxymodel.h
+++ b/src/gui/itemviews/qabstractproxymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qabstractproxymodel_p.h b/src/gui/itemviews/qabstractproxymodel_p.h
index 1ae7738..180eda3 100644
--- a/src/gui/itemviews/qabstractproxymodel_p.h
+++ b/src/gui/itemviews/qabstractproxymodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qbsptree.cpp b/src/gui/itemviews/qbsptree.cpp
index d774a70..01ea763 100644
--- a/src/gui/itemviews/qbsptree.cpp
+++ b/src/gui/itemviews/qbsptree.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qbsptree_p.h b/src/gui/itemviews/qbsptree_p.h
index 4f61cda..20cad84 100644
--- a/src/gui/itemviews/qbsptree_p.h
+++ b/src/gui/itemviews/qbsptree_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp
index da3e5a0..0eb890c 100644
--- a/src/gui/itemviews/qcolumnview.cpp
+++ b/src/gui/itemviews/qcolumnview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qcolumnview.h b/src/gui/itemviews/qcolumnview.h
index c847172..a27ae79 100644
--- a/src/gui/itemviews/qcolumnview.h
+++ b/src/gui/itemviews/qcolumnview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qcolumnview_p.h b/src/gui/itemviews/qcolumnview_p.h
index 0c096bf..cdf6d6a 100644
--- a/src/gui/itemviews/qcolumnview_p.h
+++ b/src/gui/itemviews/qcolumnview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qcolumnviewgrip.cpp b/src/gui/itemviews/qcolumnviewgrip.cpp
index 4983856..8fda074 100644
--- a/src/gui/itemviews/qcolumnviewgrip.cpp
+++ b/src/gui/itemviews/qcolumnviewgrip.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qcolumnviewgrip_p.h b/src/gui/itemviews/qcolumnviewgrip_p.h
index 2da382f..3dcdac8 100644
--- a/src/gui/itemviews/qcolumnviewgrip_p.h
+++ b/src/gui/itemviews/qcolumnviewgrip_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qdatawidgetmapper.cpp b/src/gui/itemviews/qdatawidgetmapper.cpp
index ce8b658..930c49d 100644
--- a/src/gui/itemviews/qdatawidgetmapper.cpp
+++ b/src/gui/itemviews/qdatawidgetmapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qdatawidgetmapper.h b/src/gui/itemviews/qdatawidgetmapper.h
index 8d1da7d..d1409ee 100644
--- a/src/gui/itemviews/qdatawidgetmapper.h
+++ b/src/gui/itemviews/qdatawidgetmapper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp
index 942cfd7..ea608c1 100644
--- a/src/gui/itemviews/qdirmodel.cpp
+++ b/src/gui/itemviews/qdirmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qdirmodel.h b/src/gui/itemviews/qdirmodel.h
index 7694b78..9e8e546 100644
--- a/src/gui/itemviews/qdirmodel.h
+++ b/src/gui/itemviews/qdirmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index 6316797..360ed14 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qfileiconprovider.h b/src/gui/itemviews/qfileiconprovider.h
index 70a1de9..78418e3 100644
--- a/src/gui/itemviews/qfileiconprovider.h
+++ b/src/gui/itemviews/qfileiconprovider.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 6f0fba6..8a456e6 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qheaderview.h b/src/gui/itemviews/qheaderview.h
index 0319d74..0fc92af 100644
--- a/src/gui/itemviews/qheaderview.h
+++ b/src/gui/itemviews/qheaderview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qheaderview_p.h b/src/gui/itemviews/qheaderview_p.h
index 34c8254..b30eb4f 100644
--- a/src/gui/itemviews/qheaderview_p.h
+++ b/src/gui/itemviews/qheaderview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index 3e00dba..6fd26a7 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qitemdelegate.h b/src/gui/itemviews/qitemdelegate.h
index ba38522..88a493f 100644
--- a/src/gui/itemviews/qitemdelegate.h
+++ b/src/gui/itemviews/qitemdelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qitemeditorfactory.cpp b/src/gui/itemviews/qitemeditorfactory.cpp
index e58444d..761259d 100644
--- a/src/gui/itemviews/qitemeditorfactory.cpp
+++ b/src/gui/itemviews/qitemeditorfactory.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qitemeditorfactory.h b/src/gui/itemviews/qitemeditorfactory.h
index 7303d24..6b5dc55 100644
--- a/src/gui/itemviews/qitemeditorfactory.h
+++ b/src/gui/itemviews/qitemeditorfactory.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qitemeditorfactory_p.h b/src/gui/itemviews/qitemeditorfactory_p.h
index c7e617c..5ae75e4 100644
--- a/src/gui/itemviews/qitemeditorfactory_p.h
+++ b/src/gui/itemviews/qitemeditorfactory_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index 2e4a602..cab002e 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qitemselectionmodel.h b/src/gui/itemviews/qitemselectionmodel.h
index a5b09b3..9980d0f 100644
--- a/src/gui/itemviews/qitemselectionmodel.h
+++ b/src/gui/itemviews/qitemselectionmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qitemselectionmodel_p.h b/src/gui/itemviews/qitemselectionmodel_p.h
index bbcd7aa..30583b2 100644
--- a/src/gui/itemviews/qitemselectionmodel_p.h
+++ b/src/gui/itemviews/qitemselectionmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index d03cdd3..19b1e8c 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -2621,6 +2621,13 @@ bool QIconModeViewBase::filterDropEvent(QDropEvent *e)
const QSize contents = contentsSize;
QPoint offset(horizontalOffset(), verticalOffset());
QPoint end = e->pos() + offset;
+ if (qq->acceptDrops()) {
+ const Qt::ItemFlags dropableFlags = Qt::ItemIsDropEnabled|Qt::ItemIsEnabled;
+ const QVector<QModelIndex> &dropIndices = intersectingSet(QRect(end, QSize(1, 1)));
+ foreach (const QModelIndex &index, dropIndices)
+ if ((index.flags() & dropableFlags) == dropableFlags)
+ return false;
+ }
QPoint start = dd->pressedPosition;
QPoint delta = (dd->movement == QListView::Snap ? snapToGrid(end) - snapToGrid(start) : end - start);
QList<QModelIndex> indexes = dd->selectionModel->selectedIndexes();
diff --git a/src/gui/itemviews/qlistview.h b/src/gui/itemviews/qlistview.h
index 7cf2fcd..cadd66c 100644
--- a/src/gui/itemviews/qlistview.h
+++ b/src/gui/itemviews/qlistview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h
index 31459b0..bf7657b 100644
--- a/src/gui/itemviews/qlistview_p.h
+++ b/src/gui/itemviews/qlistview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 5dd1d76..125f0c4 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -173,10 +173,11 @@ void QListModel::move(int srcRow, int dstRow)
{
if (srcRow == dstRow
|| srcRow < 0 || srcRow >= items.count()
- || dstRow < 0 || dstRow >= items.count())
+ || dstRow < 0 || dstRow > items.count())
return;
- beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow);
+ if (!beginMoveRows(QModelIndex(), srcRow, srcRow, QModelIndex(), dstRow))
+ return;
if (srcRow < dstRow)
--dstRow;
items.move(srcRow, dstRow);
diff --git a/src/gui/itemviews/qlistwidget.h b/src/gui/itemviews/qlistwidget.h
index 2b5dd6d..8d74ca2 100644
--- a/src/gui/itemviews/qlistwidget.h
+++ b/src/gui/itemviews/qlistwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qlistwidget_p.h b/src/gui/itemviews/qlistwidget_p.h
index b5f28e3..f5b97ef 100644
--- a/src/gui/itemviews/qlistwidget_p.h
+++ b/src/gui/itemviews/qlistwidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qproxymodel.cpp b/src/gui/itemviews/qproxymodel.cpp
index 8ddb04c..45e02ca 100644
--- a/src/gui/itemviews/qproxymodel.cpp
+++ b/src/gui/itemviews/qproxymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qproxymodel.h b/src/gui/itemviews/qproxymodel.h
index f4ed5fb..1a6b14b 100644
--- a/src/gui/itemviews/qproxymodel.h
+++ b/src/gui/itemviews/qproxymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qproxymodel_p.h b/src/gui/itemviews/qproxymodel_p.h
index a7b9f82..ff7e978 100644
--- a/src/gui/itemviews/qproxymodel_p.h
+++ b/src/gui/itemviews/qproxymodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index fc82f30..41c984e 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -734,6 +734,33 @@ void QSortFilterProxyModelPrivate::source_items_inserted(
}
}
+ if (model->rowCount(source_parent) == delta_item_count) {
+ // Items were inserted where there were none before.
+ // If it was new rows make sure to create mappings for columns so that a
+ // valid mapping can be retreived later and vice-versa.
+
+ QVector<int> &orthogonal_proxy_to_source = (orient == Qt::Horizontal) ? m->source_rows : m->source_columns;
+ QVector<int> &orthogonal_source_to_proxy = (orient == Qt::Horizontal) ? m->proxy_rows : m->proxy_columns;
+
+ if (orthogonal_source_to_proxy.isEmpty()) {
+ const int ortho_end = (orient == Qt::Horizontal) ? model->rowCount(source_parent) : model->columnCount(source_parent);
+
+ for (int ortho_item = 0; ortho_item < ortho_end; ++ortho_item) {
+ if ((orient == Qt::Horizontal) ? q->filterAcceptsRow(ortho_item, source_parent)
+ : q->filterAcceptsColumn(ortho_item, source_parent)) {
+ orthogonal_proxy_to_source.append(ortho_item);
+ }
+ }
+ orthogonal_source_to_proxy.resize(orthogonal_proxy_to_source.size());
+
+ if (orient == Qt::Horizontal) {
+ // We're reacting to columnsInserted, but we've just inserted new rows. Sort them.
+ sort_source_rows(orthogonal_proxy_to_source, source_parent);
+ }
+ build_source_to_proxy_mapping(orthogonal_proxy_to_source, orthogonal_source_to_proxy);
+ }
+ }
+
// Sort and insert the items
if (orient == Qt::Vertical) // Only sort rows
sort_source_rows(source_items, source_parent);
@@ -1171,9 +1198,10 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutAboutToBeChanged()
{
Q_Q(QSortFilterProxyModel);
saved_persistent_indexes.clear();
+ emit q->layoutAboutToBeChanged();
if (persistent.indexes.isEmpty())
return;
- emit q->layoutAboutToBeChanged();
+
saved_persistent_indexes = store_persistent_indexes();
}
@@ -1181,7 +1209,8 @@ void QSortFilterProxyModelPrivate::_q_sourceLayoutChanged()
{
Q_Q(QSortFilterProxyModel);
if (saved_persistent_indexes.isEmpty()) {
- q->invalidate();
+ clear_mapping();
+ emit q->layoutChanged();
return;
}
diff --git a/src/gui/itemviews/qsortfilterproxymodel.h b/src/gui/itemviews/qsortfilterproxymodel.h
index 79af6af..af980f1 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.h
+++ b/src/gui/itemviews/qsortfilterproxymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index 3924a41..9d52c78 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qstandarditemmodel.h b/src/gui/itemviews/qstandarditemmodel.h
index ea8bee9..8f966a3 100644
--- a/src/gui/itemviews/qstandarditemmodel.h
+++ b/src/gui/itemviews/qstandarditemmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qstandarditemmodel_p.h b/src/gui/itemviews/qstandarditemmodel_p.h
index 3f6e0ca..06f3e15 100644
--- a/src/gui/itemviews/qstandarditemmodel_p.h
+++ b/src/gui/itemviews/qstandarditemmodel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qstringlistmodel.cpp b/src/gui/itemviews/qstringlistmodel.cpp
index c1004c3..8d69ee4 100644
--- a/src/gui/itemviews/qstringlistmodel.cpp
+++ b/src/gui/itemviews/qstringlistmodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qstringlistmodel.h b/src/gui/itemviews/qstringlistmodel.h
index dfbc498..875b145 100644
--- a/src/gui/itemviews/qstringlistmodel.h
+++ b/src/gui/itemviews/qstringlistmodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp
index 1ca0391..9aac554 100644
--- a/src/gui/itemviews/qstyleditemdelegate.cpp
+++ b/src/gui/itemviews/qstyleditemdelegate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qstyleditemdelegate.h b/src/gui/itemviews/qstyleditemdelegate.h
index dffc12b..dc57ad8 100644
--- a/src/gui/itemviews/qstyleditemdelegate.h
+++ b/src/gui/itemviews/qstyleditemdelegate.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index d27e693..3111896 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -114,7 +114,9 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height)
}
} else if (old_height > span->height()) {
//remove the span from all the subspans lists that intersect the columns not covered anymore
- Index::iterator it_y = index.lowerBound(qMin(-span->bottom(), 0));
+ Index::iterator it_y = index.lowerBound(-span->bottom());
+ if (it_y == index.end())
+ it_y = index.find(-span->top()); // This is the only span remaining and we are deleting it.
Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list
while (-it_y.key() <= span->top() + old_height -1) {
if (-it_y.key() > span->bottom()) {
@@ -2359,12 +2361,22 @@ void QTableView::setColumnHidden(int column, bool hide)
\property QTableView::sortingEnabled
\brief whether sorting is enabled
- If this property is true, sorting is enabled for the table; if the
- property is false, sorting is not enabled. The default value is false.
+ If this property is true, sorting is enabled for the table. If
+ this property is false, sorting is not enabled. The default value
+ is false.
+
+ \note. Setting the property to true with setSortingEnabled()
+ immediately triggers a call to sortByColumn() with the current
+ sort section and order.
\sa sortByColumn()
*/
+/*!
+ If \a enabled true enables sorting for the table and immediately
+ trigger a call to sortByColumn() with the current sort section and
+ order
+ */
void QTableView::setSortingEnabled(bool enable)
{
Q_D(QTableView);
diff --git a/src/gui/itemviews/qtableview.h b/src/gui/itemviews/qtableview.h
index 541c419..8d4eaab 100644
--- a/src/gui/itemviews/qtableview.h
+++ b/src/gui/itemviews/qtableview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtableview_p.h b/src/gui/itemviews/qtableview_p.h
index 6b19ded..783e744 100644
--- a/src/gui/itemviews/qtableview_p.h
+++ b/src/gui/itemviews/qtableview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index d9b8346..f653a41 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtablewidget.h b/src/gui/itemviews/qtablewidget.h
index 4acddc1..0a2f631 100644
--- a/src/gui/itemviews/qtablewidget.h
+++ b/src/gui/itemviews/qtablewidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtablewidget_p.h b/src/gui/itemviews/qtablewidget_p.h
index 85c6d56..92166b3 100644
--- a/src/gui/itemviews/qtablewidget_p.h
+++ b/src/gui/itemviews/qtablewidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 3ad9fbb..d0fa22d 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -178,7 +178,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- Constructs a table view with a \a parent to represent a model's
+ Constructs a tree view with a \a parent to represent a model's
data. Use setModel() to set the model.
\sa QAbstractItemModel
@@ -1241,15 +1241,6 @@ bool QTreeView::viewportEvent(QEvent *event)
viewport()->update(newRect);
}
}
- if (selectionBehavior() == QAbstractItemView::SelectRows) {
- QModelIndex newHoverIndex = indexAt(he->pos());
- if (d->hover != newHoverIndex) {
- QRect oldHoverRect = visualRect(d->hover);
- QRect newHoverRect = visualRect(newHoverIndex);
- viewport()->update(QRect(0, newHoverRect.y(), viewport()->width(), newHoverRect.height()));
- viewport()->update(QRect(0, oldHoverRect.y(), viewport()->width(), oldHoverRect.height()));
- }
- }
break; }
default:
break;
@@ -2644,10 +2635,13 @@ void QTreeView::selectAll()
return;
SelectionMode mode = d->selectionMode;
d->executePostedLayout(); //make sure we lay out the items
- if (mode != SingleSelection && !d->viewItems.isEmpty())
- d->select(d->viewItems.first().index, d->viewItems.last().index,
+ if (mode != SingleSelection && !d->viewItems.isEmpty()) {
+ const QModelIndex &idx = d->viewItems.last().index;
+ QModelIndex lastItemIndex = idx.sibling(idx.row(), d->model->columnCount(idx.parent()) - 1);
+ d->select(d->viewItems.first().index, lastItemIndex,
QItemSelectionModel::ClearAndSelect
|QItemSelectionModel::Rows);
+ }
}
/*!
@@ -2774,6 +2768,7 @@ int QTreeView::sizeHintForColumn(int column) const
d->executePostedLayout();
if (d->viewItems.isEmpty())
return -1;
+ ensurePolished();
int w = 0;
QStyleOptionViewItemV4 option = d->viewOptionsV4();
const QVector<QTreeViewItem> viewItems = d->viewItems;
@@ -3063,6 +3058,8 @@ QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) cons
{
Q_Q(const QTreeView);
QPixmap pixmap(rect.size());
+ if (rect.size().isEmpty())
+ return pixmap;
pixmap.fill(Qt::transparent); //the base might not be opaque, and we don't want uninitialized pixels.
QPainter painter(&pixmap);
painter.fillRect(QRect(QPoint(0,0), rect.size()), q->palette().base());
diff --git a/src/gui/itemviews/qtreeview.h b/src/gui/itemviews/qtreeview.h
index 9cb423d..1d04893 100644
--- a/src/gui/itemviews/qtreeview.h
+++ b/src/gui/itemviews/qtreeview.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h
index d58dea3..589a224 100644
--- a/src/gui/itemviews/qtreeview_p.h
+++ b/src/gui/itemviews/qtreeview_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 948ca79..19ed10b 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtreewidget.h b/src/gui/itemviews/qtreewidget.h
index d9d421e..b56a4a7 100644
--- a/src/gui/itemviews/qtreewidget.h
+++ b/src/gui/itemviews/qtreewidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtreewidget_p.h b/src/gui/itemviews/qtreewidget_p.h
index 40133ec..27f2908 100644
--- a/src/gui/itemviews/qtreewidget_p.h
+++ b/src/gui/itemviews/qtreewidget_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtreewidgetitemiterator.cpp b/src/gui/itemviews/qtreewidgetitemiterator.cpp
index c503067..d569296 100644
--- a/src/gui/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/gui/itemviews/qtreewidgetitemiterator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtreewidgetitemiterator.h b/src/gui/itemviews/qtreewidgetitemiterator.h
index 5474958..2bd4e09 100644
--- a/src/gui/itemviews/qtreewidgetitemiterator.h
+++ b/src/gui/itemviews/qtreewidgetitemiterator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qtreewidgetitemiterator_p.h b/src/gui/itemviews/qtreewidgetitemiterator_p.h
index 726989d..a1d6703 100644
--- a/src/gui/itemviews/qtreewidgetitemiterator_p.h
+++ b/src/gui/itemviews/qtreewidgetitemiterator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/itemviews/qwidgetitemdata_p.h b/src/gui/itemviews/qwidgetitemdata_p.h
index 11adbc0..0e9aa5d 100644
--- a/src/gui/itemviews/qwidgetitemdata_p.h
+++ b/src/gui/itemviews/qwidgetitemdata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**