From 4851df0cf736fb9a8ce092411fbfd49dc679ee17 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 7 Apr 2008 21:24:31 +0000 Subject: [PATCH] set correct value for model when selecting an item whose strings occurs multiple times in the combobox git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@894 0778d3d1-df1d-0410-868b-ea421aaaa00d --- ChangeLog | 6 ++++++ src/gui/widgets/combobox.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4f42d942..d4c072ed3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-07 Tobias Doerffel + + * src/gui/widgets/combobox.cpp: + set correct value for model when selecting an item whose strings + occurs multiple times in the combobox + 2008-04-06 Tobias Doerffel * include/effect_select_dialog.h: diff --git a/src/gui/widgets/combobox.cpp b/src/gui/widgets/combobox.cpp index c56315912..bec206e7d 100644 --- a/src/gui/widgets/combobox.cpp +++ b/src/gui/widgets/combobox.cpp @@ -127,10 +127,12 @@ void comboBox::mousePressEvent( QMouseEvent * _me ) m_menu.clear(); for( int i = 0; i < model()->size(); ++i ) { - m_menu.addAction( model()->itemPixmap( i ) ? + QAction * a = m_menu.addAction( + model()->itemPixmap( i ) ? *model()->itemPixmap( i ) : QPixmap(), model()->itemText( i ) ); + a->setData( i ); } QPoint gpos = mapToGlobal( QPoint( 0, height() ) ); @@ -245,7 +247,7 @@ void comboBox::deletePixmap( QPixmap * _pixmap ) void comboBox::setItem( QAction * _item ) { - model()->setInitValue( model()->findText( _item->text() ) ); + model()->setInitValue( _item->data().toInt() ); }