summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews/qitemselectionmodel.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-21 03:18:06 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-21 03:18:06 (GMT)
commitef3560410f9ee5c851ef46298e38297a7ed42994 (patch)
tree27d16841525607dbf90273e4ef3d8d212ed0f002 /src/gui/itemviews/qitemselectionmodel.cpp
parentc12af169a157a5ba2e25289b996648a9a8e3cb9f (diff)
parentfd3b00e9aa30f8e15060292f5335b912fe42eeff (diff)
downloadQt-ef3560410f9ee5c851ef46298e38297a7ed42994.zip
Qt-ef3560410f9ee5c851ef46298e38297a7ed42994.tar.gz
Qt-ef3560410f9ee5c851ef46298e38297a7ed42994.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: add missing include Fix crash when using fonts in non-gui QApplication Deselect the current selection when the QItemSelectionModel::model is reset. Autotest fix on macosx Compile with gcc 4.0.1 improve Unicode Normalization autotest more subtests for QChar nano optimization of canonicalOrderHelper() fix canonicalOrderHelper() for some corner case use new QChar::requiresSurrogates() instead of hardcoded value prevent fake normalization prefer QChar::*surrogate() over hardcoded values Fixed an assert in QMenu
Diffstat (limited to 'src/gui/itemviews/qitemselectionmodel.cpp')
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index f848321..fc99439 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -566,6 +566,8 @@ void QItemSelectionModelPrivate::initModel(QAbstractItemModel *model)
q, SLOT(_q_layoutAboutToBeChanged()));
QObject::connect(model, SIGNAL(layoutChanged()),
q, SLOT(_q_layoutChanged()));
+ QObject::connect(model, SIGNAL(modelAboutToBeReset()),
+ q, SLOT(_q_modelAboutToBeReset()));
}
}
@@ -896,6 +898,13 @@ void QItemSelectionModelPrivate::_q_layoutChanged()
savedPersistentCurrentIndexes.clear();
}
+void QItemSelectionModelPrivate::_q_modelAboutToBeReset()
+{
+ Q_Q(QItemSelectionModel);
+ q->clearSelection();
+ clearCurrentIndex();
+}
+
/*!
\class QItemSelectionModel
@@ -1095,12 +1104,18 @@ void QItemSelectionModel::clear()
{
Q_D(QItemSelectionModel);
clearSelection();
- QModelIndex previous = d->currentIndex;
- d->currentIndex = QModelIndex();
+ d->clearCurrentIndex();
+}
+
+void QItemSelectionModelPrivate::clearCurrentIndex()
+{
+ Q_Q(QItemSelectionModel);
+ QModelIndex previous = currentIndex;
+ currentIndex = QModelIndex();
if (previous.isValid()) {
- emit currentChanged(d->currentIndex, previous);
- emit currentRowChanged(d->currentIndex, previous);
- emit currentColumnChanged(d->currentIndex, previous);
+ emit q->currentChanged(currentIndex, previous);
+ emit q->currentRowChanged(currentIndex, previous);
+ emit q->currentColumnChanged(currentIndex, previous);
}
}