camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp
changeset 39 c5025ea871a1
parent 38 0f0b4c1d7744
child 37 64817133cd1d
equal deleted inserted replaced
38:0f0b4c1d7744 39:c5025ea871a1
    65         setPreviewMode(HbRadioButtonList::NoPreview);
    65         setPreviewMode(HbRadioButtonList::NoPreview);
    66         mPreview = data->mPreview;
    66         mPreview = data->mPreview;
    67 
    67 
    68         setSettingId(data->mSettingId);
    68         setSettingId(data->mSettingId);
    69         setListBoxType(data->mListboxType);
    69         setListBoxType(data->mListboxType);
    70     }
    70 
    71 
    71         initOriginalSelectedItem();
       
    72         // ensure that currently selected item is visible
       
    73         scrollTo(currentIndex());
       
    74     }
       
    75 
       
    76 }
       
    77 
       
    78 /*!
       
    79  * Sets the original selection of list by value. Can be used to override value read from
       
    80  * CxeSettings or used to remember previously selected value in case of setting that is
       
    81  * not read from CxeSettings (e.g. selftimer)
       
    82  */
       
    83 void CxuiSettingRadioButtonList::setOriginalSelectedItemByValue(const QVariant &value)
       
    84 {
       
    85     CX_DEBUG_ENTER_FUNCTION();
       
    86 
       
    87     int index = mSettingValues.indexOf(QVariant(value));
       
    88     if (index >= 0) {
       
    89         mOriginalIndex = index;
       
    90         setSelected(index);
       
    91         // ensure that currently selected item is visible
       
    92         scrollTo(currentIndex());
       
    93     } else {
       
    94         CX_DEBUG(("Value %s not found", value.toString().toAscii().data()));
       
    95     }
       
    96     CX_DEBUG_EXIT_FUNCTION();
    72 }
    97 }
    73 
    98 
    74 void CxuiSettingRadioButtonList::setItems(const QStringList &values)
    99 void CxuiSettingRadioButtonList::setItems(const QStringList &values)
    75 {
   100 {
    76     mListModel->setItems(values);
   101     mListModel->setItems(values);
    99     } else {
   124     } else {
   100         // no action needed
   125         // no action needed
   101     }
   126     }
   102     CX_DEBUG_EXIT_FUNCTION();
   127     CX_DEBUG_EXIT_FUNCTION();
   103 }
   128 }
   104 
       
   105 void CxuiSettingRadioButtonList::showEvent(QShowEvent *event)
       
   106 {
       
   107     CX_DEBUG_ENTER_FUNCTION();
       
   108 
       
   109     initOriginalSelectedItem();
       
   110     // ensure that currently selected item is visible
       
   111     scrollTo(currentIndex());
       
   112     QGraphicsWidget::showEvent(event);
       
   113 
       
   114     CX_DEBUG_EXIT_FUNCTION();
       
   115 }
       
   116 
       
   117 
   129 
   118 /*!
   130 /*!
   119 *  Get the value currently active in settings.
   131 *  Get the value currently active in settings.
   120 */
   132 */
   121 void CxuiSettingRadioButtonList::initOriginalSelectedItem()
   133 void CxuiSettingRadioButtonList::initOriginalSelectedItem()