diff -r 699651f2666f -r 5c1e3c6aa4ef camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp --- a/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Thu May 27 12:43:29 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp Fri Jun 11 13:26:48 2010 +0300 @@ -67,10 +67,35 @@ setSettingId(data->mSettingId); setListBoxType(data->mListboxType); + + initOriginalSelectedItem(); + // ensure that currently selected item is visible + scrollTo(currentIndex()); } } +/*! + * Sets the original selection of list by value. Can be used to override value read from + * CxeSettings or used to remember previously selected value in case of setting that is + * not read from CxeSettings (e.g. selftimer) + */ +void CxuiSettingRadioButtonList::setOriginalSelectedItemByValue(const QVariant &value) +{ + CX_DEBUG_ENTER_FUNCTION(); + + int index = mSettingValues.indexOf(QVariant(value)); + if (index >= 0) { + mOriginalIndex = index; + setSelected(index); + // ensure that currently selected item is visible + scrollTo(currentIndex()); + } else { + CX_DEBUG(("Value %s not found", value.toString().toAscii().data())); + } + CX_DEBUG_EXIT_FUNCTION(); +} + void CxuiSettingRadioButtonList::setItems(const QStringList &values) { mListModel->setItems(values); @@ -102,19 +127,6 @@ CX_DEBUG_EXIT_FUNCTION(); } -void CxuiSettingRadioButtonList::showEvent(QShowEvent *event) -{ - CX_DEBUG_ENTER_FUNCTION(); - - initOriginalSelectedItem(); - // ensure that currently selected item is visible - scrollTo(currentIndex()); - QGraphicsWidget::showEvent(event); - - CX_DEBUG_EXIT_FUNCTION(); -} - - /*! * Get the value currently active in settings. */