diff -r 923ff622b8b9 -r 4633027730f5 src/hbwidgets/sliders/hbprogresssliderhandle_p.cpp --- a/src/hbwidgets/sliders/hbprogresssliderhandle_p.cpp Tue Jul 06 14:36:53 2010 +0300 +++ b/src/hbwidgets/sliders/hbprogresssliderhandle_p.cpp Wed Aug 18 10:05:37 2010 +0300 @@ -24,6 +24,7 @@ ****************************************************************************/ #include "hbprogresssliderhandle_p.h" +#include "hbstyle_p.h" #include #include #include @@ -62,12 +63,10 @@ mFlags = 0; mFlags |= TextVisible; - HbStyle *style = static_cast(q->style()); - - mHandleIconItem = style->createPrimitive(HbStyle::P_ProgressSliderHandle_icon,this); + mHandleIconItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_ProgressSliderHandle_icon,this); HbStyle::setItemName(mHandleIconItem , "icon"); - mTouchItem = style->createPrimitive(HbStyle::P_ProgressSliderHandle_toucharea, this); + mTouchItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_ProgressSliderHandle_toucharea, this); HbStyle::setItemName(mTouchItem , "toucharea"); setProperty("state","normal"); @@ -94,16 +93,12 @@ void HbProgressSliderHandle::setHandleIcon(const HbIcon& icon) { - if(icon.isNull()) { - return; - } - HbStyle *style = qobject_cast(q->style()); mHandleIcon= icon; HbStyleOptionProgressSliderHandle option; initStyleOption(&option); - style->updatePrimitive(mHandleIconItem, HbStyle::P_ProgressSliderHandle_icon, &option); + HbStylePrivate::updatePrimitive(mHandleIconItem, HbStylePrivate::P_ProgressSliderHandle_icon, &option); } @@ -126,7 +121,7 @@ initStyleOption(&option); option.pressedState = true; if (mHandleIconItem) { - style()->updatePrimitive(mHandleIconItem, HbStyle::P_ProgressSliderHandle_icon, &option); + HbStylePrivate::updatePrimitive(mHandleIconItem, HbStylePrivate::P_ProgressSliderHandle_icon, &option); } mMousePressPos = event->scenePos(); @@ -137,15 +132,18 @@ event->accept(); q->emitSliderPressed(); - if(q->textVisible()) { - HbToolTip::showText(q->toolTipText(),this, QRectF(mItemPosAtPress,QSize(0,0)),q->textAlignment()); - } - else { - HbExtendedLocale locale; - HbProgressSlider *slider = (HbProgressSlider*)q->parentGraphicsWidget(); - HbToolTip::showText(locale.toString(slider->sliderValue()),this, QRectF(mItemCurPos,QSize(0,0)),q->textAlignment()); - } + if(q->textVisible()) { // User called it + if(!q->toolTipText().isNull()) { + HbToolTip::showText(q->toolTipText(),this, QRectF(mItemPosAtPress,QSize(0,0)),q->textAlignment()); + } + } + else { // show default + HbExtendedLocale locale; + HbProgressSlider *slider = (HbProgressSlider*)q->parentGraphicsWidget(); + HbToolTip::showText(locale.toString(slider->sliderValue()),this, QRectF(mItemCurPos,QSize(0,0)),q->textAlignment()); + + } } void HbProgressSliderHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) @@ -156,7 +154,7 @@ initStyleOption(&option); option.pressedState = false; if (mHandleIconItem) { - style()->updatePrimitive(mHandleIconItem, HbStyle::P_ProgressSliderHandle_icon, &option); + HbStylePrivate::updatePrimitive(mHandleIconItem, HbStylePrivate::P_ProgressSliderHandle_icon, &option); } if (isHandleMoving()) { @@ -224,14 +222,25 @@ q->emitSliderMoved(pointToValue(mItemCurPos)); - if(q->textVisible()) { - HbToolTip::showText(q->toolTipText(),this, QRectF(mItemCurPos,QSize(0,0)),q->textAlignment()); - } - else { - HbExtendedLocale locale; - HbProgressSlider *slider = (HbProgressSlider*)q->parentGraphicsWidget(); - HbToolTip::showText(locale.toString(slider->sliderValue()),this, QRectF(mItemCurPos,QSize(0,0)),q->textAlignment()); - } + if(q->textVisible()) { // User called it + if(q->toolTipText().isNull()) { + + // Dont show any tooltip. + + } + else { + + HbToolTip::showText(q->toolTipText(),this, QRectF(mItemPosAtPress,QSize(0,0)),q->textAlignment()); + + } + } + else { // show default + + HbExtendedLocale locale; + HbProgressSlider *slider = (HbProgressSlider*)q->parentGraphicsWidget(); + HbToolTip::showText(locale.toString(slider->sliderValue()),this, QRectF(mItemCurPos,QSize(0,0)),q->textAlignment()); + + } } int HbProgressSliderHandle::pointToValue(QPointF point) const @@ -383,7 +392,7 @@ initStyleOption(&option); if (mHandleIconItem) { - style()->updatePrimitive(mHandleIconItem, HbStyle::P_ProgressSliderHandle_icon, &option); + HbStylePrivate::updatePrimitive(mHandleIconItem, HbStylePrivate::P_ProgressSliderHandle_icon, &option); } } @@ -395,9 +404,9 @@ QGraphicsItem* HbProgressSliderHandle::primitive(HbStyle::Primitive primitive) const { switch (primitive) { - case HbStyle::P_ProgressSliderHandle_icon: + case HbStylePrivate::P_ProgressSliderHandle_icon: return mHandleIconItem; - case HbStyle::P_ProgressSliderHandle_toucharea: + case HbStylePrivate::P_ProgressSliderHandle_toucharea: return mTouchItem; default: return 0;