24 ****************************************************************************/ |
24 ****************************************************************************/ |
25 |
25 |
26 #include "hbdatetimepicker.h" |
26 #include "hbdatetimepicker.h" |
27 #include "hbdatetimepicker_p.h" |
27 #include "hbdatetimepicker_p.h" |
28 #include "hbstyleoption_p.h" |
28 #include "hbstyleoption_p.h" |
|
29 #include "hbframeitem.h" |
|
30 #include "hbstyleprimitivedata.h" |
|
31 #include <hbstyleframeprimitivedata.h> |
29 |
32 |
30 /*! |
33 /*! |
31 @beta |
34 @beta |
32 \class HbDateTimePicker |
35 \class HbDateTimePicker |
33 \brief The HbDateTimePicker class provides a widget that has multiple vertical tumblers |
36 \brief The HbDateTimePicker class provides a widget that has multiple vertical tumblers |
252 d->init(QVariant::DateTime); |
255 d->init(QVariant::DateTime); |
253 } |
256 } |
254 |
257 |
255 |
258 |
256 bool HbDateTimePicker::event(QEvent *e) |
259 bool HbDateTimePicker::event(QEvent *e) |
257 { |
260 { |
|
261 Q_D(HbDateTimePicker); |
|
262 |
258 bool result = HbWidget::event(e); |
263 bool result = HbWidget::event(e); |
259 if (e->type()==QEvent::LayoutRequest) { |
264 if(e->type() == d->mFormatEventType){ |
|
265 d->processFormatEvent(); |
|
266 } |
|
267 else if (e->type()==QEvent::LayoutRequest) { |
260 updatePrimitives(); |
268 updatePrimitives(); |
261 } |
269 } |
262 return result; |
270 return result; |
263 } |
271 } |
|
272 |
264 |
273 |
265 /*! |
274 /*! |
266 Destructor. |
275 Destructor. |
267 */ |
276 */ |
268 HbDateTimePicker::~HbDateTimePicker() |
277 HbDateTimePicker::~HbDateTimePicker() |
803 { |
810 { |
804 HbWidget::setGeometry(rect); |
811 HbWidget::setGeometry(rect); |
805 updatePrimitives(); |
812 updatePrimitives(); |
806 } |
813 } |
807 |
814 |
808 |
815 void HbDateTimePicker::initPrimitiveData(HbStylePrimitiveData *primitiveData, const QGraphicsObject *primitive) |
|
816 { |
|
817 HbWidget::initPrimitiveData(primitiveData, primitive); |
|
818 QString itemName = HbStyle::itemName(primitive); |
|
819 if(itemName == QLatin1String("background")) { |
|
820 HbStyleFramePrimitiveData *frameItem = hbstyleprimitivedata_cast<HbStyleFramePrimitiveData*>(primitiveData); |
|
821 frameItem->frameGraphicsName= QLatin1String("qtg_fr_tumbler_bg"); |
|
822 frameItem->frameType = HbFrameDrawer::NinePieces; |
|
823 (const_cast<QGraphicsObject *> (primitive))->setZValue(-5); |
|
824 } |
|
825 |
|
826 if(itemName == QLatin1String("frame")) { |
|
827 HbStyleFramePrimitiveData *frameItem = hbstyleprimitivedata_cast<HbStyleFramePrimitiveData*>(primitiveData); |
|
828 frameItem->frameGraphicsName= QLatin1String("qtg_fr_tumbler_overlay"); |
|
829 frameItem->frameType = HbFrameDrawer::NinePieces; |
|
830 (const_cast<QGraphicsObject *> (primitive))->setZValue(1); |
|
831 |
|
832 } |
|
833 if(itemName == QLatin1String("highlight")) { |
|
834 HbStyleFramePrimitiveData *frameItem = hbstyleprimitivedata_cast<HbStyleFramePrimitiveData*>(primitiveData); |
|
835 frameItem->frameGraphicsName= QLatin1String("qtg_fr_tumbler_highlight_pri"); |
|
836 frameItem->frameType = HbFrameDrawer::ThreePiecesHorizontal; |
|
837 (const_cast<QGraphicsObject *> (primitive))->setZValue(-1); |
|
838 |
|
839 } |
|
840 |
|
841 } |
809 void HbDateTimePicker::updatePrimitives() |
842 void HbDateTimePicker::updatePrimitives() |
810 { |
843 { |
811 Q_D(HbDateTimePicker); |
844 Q_D(HbDateTimePicker); |
812 HbStyleOption option; |
845 HbWidget::updatePrimitives(); |
813 initStyleOption(&option); |
846 |
814 if(d->mBackground) { |
847 if(d->mBackground){ |
815 HbStylePrivate::updatePrimitive(d->mBackground,HbStylePrivate::P_DateTimePicker_background,&option); |
848 HbStyleFramePrimitiveData data; |
816 } |
849 initPrimitiveData(&data,d->mBackground); |
|
850 style()->updatePrimitive(d->mBackground,&data,this); |
|
851 } |
|
852 |
817 if(d->mFrame) { |
853 if(d->mFrame) { |
818 HbStylePrivate::updatePrimitive(d->mFrame,HbStylePrivate::P_DateTimePicker_frame,&option); |
854 HbStyleFramePrimitiveData data; |
|
855 initPrimitiveData(&data,d->mFrame); |
|
856 style()->updatePrimitive(d->mFrame,&data,this); |
819 } |
857 } |
820 |
858 |
821 if(d->mHighlight) { |
859 if(d->mHighlight) { |
822 HbStylePrivate::updatePrimitive(d->mHighlight,HbStylePrivate::P_TumbleView_highlight,&option); |
860 HbStyleFramePrimitiveData data; |
823 } |
861 initPrimitiveData (&data,d->mHighlight); |
|
862 style()->updatePrimitive(d->mHighlight,&data,this); |
|
863 } |
|
864 |
824 } |
865 } |
825 |
866 |
826 #include "moc_hbdatetimepicker.cpp" |
867 #include "moc_hbdatetimepicker.cpp" |