src/hbwidgets/dataform/hbdataformviewitem_p.cpp
changeset 21 4633027730f5
parent 7 923ff622b8b9
child 23 e6ad4ef83b23
equal deleted inserted replaced
7:923ff622b8b9 21:4633027730f5
   354         mDialog->setTimeout(HbPopup::NoTimeout);    
   354         mDialog->setTimeout(HbPopup::NoTimeout);    
   355         mDialog->setAttribute(Qt::WA_DeleteOnClose);
   355         mDialog->setAttribute(Qt::WA_DeleteOnClose);
   356         mDialog->setDismissPolicy(HbPopup::NoDismiss);
   356         mDialog->setDismissPolicy(HbPopup::NoDismiss);
   357         mDialog->setModal(true);
   357         mDialog->setModal(true);
   358         mDialog->setContentWidget(mRadioButtonList);   
   358         mDialog->setContentWidget(mRadioButtonList);   
   359         HbAction *ok = new HbAction(QString("Ok"));
   359         HbAction *ok = new HbAction(hbTrId("txt_common_button_ok"));
   360         mDialog->addAction(ok);
   360         mDialog->addAction(ok);
   361         HbAction *cancel = new HbAction(QString("Cancel"));
   361         HbAction *cancel = new HbAction(hbTrId("txt_common_button_cancel"));
   362         connect(ok, SIGNAL(triggered()), mDialog,SLOT(accept()));
   362         connect(ok, SIGNAL(triggered()), mDialog,SLOT(accept()));
   363         mDialog->addAction(cancel);
   363         mDialog->addAction(cancel);
   364         mDialog->connect(cancel, SIGNAL(triggered()), mDialog, SLOT(reject()));
   364         mDialog->connect(cancel, SIGNAL(triggered()), mDialog, SLOT(reject()));
   365         mRadioButtonList->setSelected(mSelected);       
   365         mRadioButtonList->setSelected(mSelected);       
   366         mDialog->open(this,SLOT(dialogClosed(int)));
   366         mDialog->open(this,SLOT(dialogClosed(int)));
   705 void HbDataFormViewItemPrivate::createPrimitives()
   705 void HbDataFormViewItemPrivate::createPrimitives()
   706 {
   706 {
   707     Q_Q( HbDataFormViewItem );
   707     Q_Q( HbDataFormViewItem );
   708 
   708 
   709     if( !mBackgroundItem ) {
   709     if( !mBackgroundItem ) {
   710         mBackgroundItem = q->style()->createPrimitive( HbStyle::P_DataItem_background, q );
   710         mBackgroundItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_DataItem_background, q );
   711     }
   711     }
   712     
   712     
   713 
   713 
   714     if( !mLabel.isEmpty() ) {
   714     if( !mLabel.isEmpty() ) {
   715         if( !mLabelItem ) {
   715         if( !mLabelItem ) {
   716             mLabelItem = q->style()->createPrimitive( HbStyle::P_DataItem_label, q );
   716             mLabelItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_DataItem_label, q );
   717         }
   717         }
   718     } else {
   718     } else {
   719         if( mLabelItem ) {
   719         if( mLabelItem ) {
   720             HbStyle::setItemName( mLabelItem, NULL );
   720             HbStyle::setItemName( mLabelItem, NULL );
   721             delete mLabelItem;
   721             delete mLabelItem;
   725     }
   725     }
   726 
   726 
   727     if( !mIcon.isEmpty() ) {
   727     if( !mIcon.isEmpty() ) {
   728         q->setProperty( "hasIcon", true );
   728         q->setProperty( "hasIcon", true );
   729         if(!mIconItem) {
   729         if(!mIconItem) {
   730             mIconItem = q->style()->createPrimitive( HbStyle::P_DataItem_icon, q );
   730             mIconItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_DataItem_icon, q );
   731         }
   731         }
   732     } else {
   732     } else {
   733         q->setProperty( "hasIcon", false );
   733         q->setProperty( "hasIcon", false );
   734         if( mIconItem ) {
   734         if( mIconItem ) {
   735             HbStyle::setItemName( mIconItem, NULL );
   735             HbStyle::setItemName( mIconItem, NULL );
   738         }
   738         }
   739     }
   739     }
   740 
   740 
   741     if(!mDescription.isEmpty()) {
   741     if(!mDescription.isEmpty()) {
   742         if(!mDescriptionItem) {
   742         if(!mDescriptionItem) {
   743             mDescriptionItem = q->style()->createPrimitive(HbStyle::P_DataItem_description, q);
   743             mDescriptionItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_DataItem_description, q);
   744         }
   744         }
   745     } else {
   745     } else {
   746         if( mDescriptionItem ) {
   746         if( mDescriptionItem ) {
   747             HbStyle::setItemName( mDescriptionItem, NULL );
   747             HbStyle::setItemName( mDescriptionItem, NULL );
   748             delete mDescriptionItem;
   748             delete mDescriptionItem;
   793 
   793 
   794     HbStyleOptionDataFormViewItem options;
   794     HbStyleOptionDataFormViewItem options;
   795     q->initStyleOption(&options);
   795     q->initStyleOption(&options);
   796 
   796 
   797     if( mBackgroundItem ) {
   797     if( mBackgroundItem ) {
   798         q->style()->updatePrimitive(
   798         HbStylePrivate::updatePrimitive(
   799             mBackgroundItem, HbStyle::P_DataItem_background, &options );
   799             mBackgroundItem, HbStylePrivate::P_DataItem_background, &options );
   800     }
   800     }
   801 
   801 
   802     if( mLabelItem ) {
   802     if( mLabelItem ) {
   803         q->style()->updatePrimitive( mLabelItem, HbStyle::P_DataItem_label, &options );
   803         HbStylePrivate::updatePrimitive( mLabelItem, HbStylePrivate::P_DataItem_label, &options );
   804     }
   804     }
   805 
   805 
   806     if( mIconItem ) {
   806     if( mIconItem ) {
   807         q->style()->updatePrimitive(
   807         HbStylePrivate::updatePrimitive(
   808             mIconItem, HbStyle::P_DataItem_icon, &options );
   808             mIconItem, HbStylePrivate::P_DataItem_icon, &options );
   809     }
   809     }
   810     
   810     
   811     if(mDescriptionItem) {
   811     if(mDescriptionItem) {
   812         q->style()->updatePrimitive(mDescriptionItem, HbStyle::P_DataItem_description, &options);
   812         HbStylePrivate::updatePrimitive(mDescriptionItem, HbStylePrivate::P_DataItem_description, &options);
   813     }
   813     }
   814 }
   814 }
   815 
   815 
   816 /*
   816 /*
   817     Sets the label/ heading for the setting item . If no label set the label widget 
   817     Sets the label/ heading for the setting item . If no label set the label widget 
   925         if( ( mType == HbDataFormModelItem::SliderItem ) ||
   925         if( ( mType == HbDataFormModelItem::SliderItem ) ||
   926             ( mType == HbDataFormModelItem::VolumeSliderItem ) ) {
   926             ( mType == HbDataFormModelItem::VolumeSliderItem ) ) {
   927                 HbSlider *slider = static_cast<HbSlider*>( mContentWidget );
   927                 HbSlider *slider = static_cast<HbSlider*>( mContentWidget );
   928                 if( enabled ) {
   928                 if( enabled ) {
   929                     //grab pan gesture
   929                     //grab pan gesture
   930                     slider->primitive(HbStyle::P_SliderElement_touchgroove)->toGraphicsObject()->grabGesture(
   930                     slider->primitive((HbStyle::Primitive)HbStylePrivate::P_SliderElement_touchgroove)->toGraphicsObject()->grabGesture(
   931                         Qt::PanGesture);
   931                         Qt::PanGesture);
   932                 } else {
   932                 } else {
   933                     //ungrab pan gesture
   933                     //ungrab pan gesture
   934                     slider->primitive(HbStyle::P_SliderElement_touchgroove)->toGraphicsObject()->ungrabGesture(
   934                     slider->primitive((HbStyle::Primitive)HbStylePrivate::P_SliderElement_touchgroove)->toGraphicsObject()->ungrabGesture(
   935                         Qt::PanGesture);
   935                         Qt::PanGesture);
   936                 }
   936                 }
   937         }
   937         }
   938     }
   938     }
   939 }
   939 }
  1060 
  1060 
  1061     //update only the background primitive
  1061     //update only the background primitive
  1062     HbStyleOptionDataFormViewItem options;
  1062     HbStyleOptionDataFormViewItem options;
  1063     q->initStyleOption(&options);
  1063     q->initStyleOption(&options);
  1064     if( mBackgroundItem ) {
  1064     if( mBackgroundItem ) {
  1065         q->style()->updatePrimitive(
  1065         HbStylePrivate::updatePrimitive(
  1066             mBackgroundItem, HbStyle::P_DataItem_background, &options );
  1066             mBackgroundItem, HbStylePrivate::P_DataItem_background, &options );
  1067     }
  1067     }
  1068 
  1068 
  1069     //if ( mContentWidget ) {
  1069     //if ( mContentWidget ) {
  1070     //    QEvent polishEvent( QEvent::Polish );
  1070     //    QEvent polishEvent( QEvent::Polish );
  1071     //    QCoreApplication::sendEvent( mContentWidget, &polishEvent );
  1071     //    QCoreApplication::sendEvent( mContentWidget, &polishEvent );