controlpanel/src/cpframework/src/cpitemdatahelper.cpp
changeset 21 851e19007849
parent 18 e3554c9069b6
child 23 7e4c5a2ff1a2
equal deleted inserted replaced
19:30540fccecae 21:851e19007849
    17 #include "cpitemdatahelper.h"
    17 #include "cpitemdatahelper.h"
    18 #include <QList>
    18 #include <QList>
    19 #include <hbdataform.h>
    19 #include <hbdataform.h>
    20 #include <hbdataformmodelitem.h>
    20 #include <hbdataformmodelitem.h>
    21 #include <hbdataformviewitem.h>
    21 #include <hbdataformviewitem.h>
    22 
    22 #include <hbdataformmodel.h>
    23 
    23 
    24 class CpItemDataHelperPrivate
    24 class CpItemDataHelperPrivate
    25 {
    25 {
    26 public:
    26 public:
    27     class ItemConnection
    27     class ItemConnection
   172 
   172 
   173     HbWidget *widgetFromModelIndex(const QModelIndex &index)
   173     HbWidget *widgetFromModelIndex(const QModelIndex &index)
   174     {
   174     {
   175         if (mDataForm) {
   175         if (mDataForm) {
   176             HbDataFormViewItem *viewItem = mDataForm->dataFormViewItem(index);
   176             HbDataFormViewItem *viewItem = mDataForm->dataFormViewItem(index);
   177             return viewItem->dataItemContentWidget();
   177             if (viewItem) {
       
   178                 return viewItem->dataItemContentWidget();
       
   179             }
       
   180         }
       
   181         return 0;
       
   182     }
       
   183     
       
   184     HbDataFormModelItem *modelItemFromModelIndex(const QModelIndex &index)
       
   185     {
       
   186         if (mDataForm) {
       
   187             HbDataFormModel *dataFormModel = 
       
   188                     qobject_cast<HbDataFormModel*>(mDataForm->model());
       
   189             if (dataFormModel) {
       
   190                 return dataFormModel->itemFromIndex(index);
       
   191             }
   178         }
   192         }
   179         return 0;
   193         return 0;
   180     }
   194     }
   181 
   195 
   182 public:
   196 public:
   276 */
   290 */
   277 HbWidget *CpItemDataHelper::widgetFromModelIndex(const QModelIndex &index)
   291 HbWidget *CpItemDataHelper::widgetFromModelIndex(const QModelIndex &index)
   278 {
   292 {
   279     return d->widgetFromModelIndex(index);
   293     return d->widgetFromModelIndex(index);
   280 }
   294 }
       
   295 
       
   296 HbDataFormModelItem *CpItemDataHelper::modelItemFromModelIndex(const QModelIndex &index)
       
   297 {
       
   298     return d->modelItemFromModelIndex(index);
       
   299 }
       
   300 
       
   301 //End of File