From a29374fc8ecb9fc17ac125d730eed9c8ec98badb Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 29 Jan 2015 12:19:14 +0100 Subject: QComboBox: use QModelIndex::sibling() instead of index()+parent() QAIM::sibling() may be more efficient, esp. in cases where only the column number needs to be adjusted. It is a no-op if the column number is already correct. Change-Id: Iabb8d5ef58d083da971a9d2f3702908257e5cc0a Reviewed-by: David Faure --- src/widgets/widgets/qcombobox.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 16e1024085..65ec3f7d7b 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -2069,9 +2069,7 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi) { Q_Q(QComboBox); - QModelIndex normalized; - if (mi.column() != modelColumn) - normalized = model->index(mi.row(), modelColumn, mi.parent()); + QModelIndex normalized = mi.sibling(mi.row(), modelColumn); // no-op if mi.column() == modelColumn if (!normalized.isValid()) normalized = mi; // Fallback to passed index. -- cgit v1.2.3