summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2010-05-25 18:09:00 (GMT)
committerQt Commercial Integration <QtCommercial@digia.com>2012-01-31 10:24:51 (GMT)
commit1e8a1b289a1333b9e6887c4242e576be695e5857 (patch)
treef2e1d3ee2c98aa82bb9fa0dcff6a21c21986e1b9 /tests
parentbdaf3903545e9f1fbd70008ad6a506a650e1afb8 (diff)
downloadQt-1e8a1b289a1333b9e6887c4242e576be695e5857.zip
Qt-1e8a1b289a1333b9e6887c4242e576be695e5857.tar.gz
Qt-1e8a1b289a1333b9e6887c4242e576be695e5857.tar.bz2
QComboBox::modelColumn was not respected when selecting an item
Auto-test included Reviewed-by: Olivier Task-number: QTBUG-10491
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index e27dcaa..666632d 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -157,6 +157,7 @@ private slots:
void keyBoardNavigationWithMouse();
void task_QTBUG_1071_changingFocusEmitsActivated();
void maxVisibleItems();
+ void task_QTBUG_10491_currentIndexAndModelColumn();
protected slots:
void onEditTextChanged( const QString &newString );
@@ -2560,6 +2561,24 @@ void tst_QComboBox::maxVisibleItems()
// QCombobox without a popup does not work, see QTBUG-760
}
+void tst_QComboBox::task_QTBUG_10491_currentIndexAndModelColumn()
+{
+ QComboBox comboBox;
+
+ QStandardItemModel model(4, 4, &comboBox);
+ for (int i = 0; i < 4; i++){
+ model.setItem(i, 0, new QStandardItem(QString("Employee Nr %1").arg(i)));
+ model.setItem(i, 1, new QStandardItem(QString("Street Nr %1").arg(i)));
+ model.setItem(i, 2, new QStandardItem(QString("Town Nr %1").arg(i)));
+ model.setItem(i, 3, new QStandardItem(QString("Phone Nr %1").arg(i)));
+ }
+ comboBox.setModel(&model);
+ comboBox.setModelColumn(0);
+
+ QComboBoxPrivate *d = static_cast<QComboBoxPrivate *>(QComboBoxPrivate::get(&comboBox));
+ d->setCurrentIndex(model.index(2, 2));
+ QCOMPARE(QModelIndex(d->currentIndex), model.index(2, comboBox.modelColumn()));
+}
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"