diff -r 923ff622b8b9 -r 4633027730f5 src/hbcore/style/hbstyle.cpp --- a/src/hbcore/style/hbstyle.cpp Tue Jul 06 14:36:53 2010 +0300 +++ b/src/hbcore/style/hbstyle.cpp Wed Aug 18 10:05:37 2010 +0300 @@ -96,7 +96,6 @@ #include "hbrepeaticonitem_p.h" #include "hbnamespace_p.h" - #include "hbanchorlayout.h" #include @@ -109,6 +108,11 @@ #include #include +#ifdef HB_TEXT_MEASUREMENT_UTILITY +#include "hbinstance_p.h" +#include "hbfeaturemanager_r.h" +#endif + Q_DECLARE_METATYPE(QGraphicsLayout*) //Uncomment next define(s) in order to get more debug prints. @@ -134,664 +138,18 @@ call the updatePrimitive method. Generally primitives should be updated only when a state change occurs. When a widget uses primitives to construct - itself it does not need a paint() method at all since primitives (widget's children) are doing the drawing. + itself it does not need a paint() method at all since primitives (widget's children) are doing the drawing. Painting for the primitives occurs from the graphics scene. - HbStyle has some caching functionality and thus it should not be instantiated explicitly, but + HbStyle has some caching functionality and thus it should not be instantiated explicitly, but accessed only through HbWidget::style() or HbInstance::style() APIs. */ -/*! - - \deprecated P_PushButton_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_PushButton_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_PushButton_additionaltext - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_PushButton_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_PushButton_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_PushButton_focus - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataGrou\deprecated P_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataGroupComboBackground - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataGrou\deprecated P_heading - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataGrou\deprecated P_description - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataForm_heading - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataForm_heading_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataForm_description - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataGrou\deprecated P_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ToolButton_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ToolButton_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ToolButton_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Slider_thumb - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderElement_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderElement_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderElement_increase - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderElement_decrease - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Slider_groove - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Slider_progressgroove - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ItemViewItem_checkbox - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ItemViewItem_radiobutton - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ItemViewItem_selection - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_LineEdit_frame_normal - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_LineEdit_frame_highlight - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TextEdit_frame_normal - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TextEdit_frame_highlight - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Edit_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Label_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Label_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_MenuItem_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_MenuItem_focus - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_MenuItem_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_MenuItem_submenuindicator - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_MenuItem_checkindicator - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_MenuItem_separator - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ScrollBar_groove - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ScrollBar_handle - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ScrollBar_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Popu\deprecated P_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Popu\deprecated P_background_weak - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Popu\deprecated P_heading_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ToolTi\deprecated P_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_MessageBox_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ItemViewItem_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ListViewItem_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ListViewItem_richtext - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ListViewItem_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ItemHighlight_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ToolBarExtension_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_GridViewItem_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_GridViewItem_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_CheckBox_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_CheckBox_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_CheckBox_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Fade_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TitlePane_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TitlePane_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TitlePane_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TitleBar_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorGrou\deprecated P_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorGrou\deprecated P_signalicon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorGrou\deprecated P_batteryicon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SignalIndicator_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SignalLevel_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SignalLevel_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_BatteryIndicator_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_BatteryLevel_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_BatteryLevel_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorGrou\deprecated P_icon1 - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorGrou\deprecated P_icon2 - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorGrou\deprecated P_icon3 - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorGrou\deprecated P_icon4 - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressBar_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressBar_track - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressBar_waittrack - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressBar_mintext - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressBar_maxtext - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Softkey_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_NavigationButton_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorButton_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndicatorButton_handleindication - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ItemViewItem_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SelectionControl_selectionstart - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SelectionControl_selectionend - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TreeViewItem_expandicon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_Label_richtext - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_RatingSlider_track - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_RatingSlider_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_RatingSlider_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSlider_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSlider_track - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSlider_slidertrack - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSlider_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSliderHandle_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSliderHandle_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSliderHandle_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_RatingSlider_layout - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ScrollArea_continuationbottom - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ScrollArea_continuationtop - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ScrollArea_continuationleft - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ScrollArea_continuationright - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ItemViewItem_focus - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_NotificationDialog_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_NotificationDialog_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_NotificationDialog_title - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_NotificationDialog_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ComboBox_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ComboBoxPopu\deprecated P_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ComboBoxButton_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ComboBox_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataItem_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataItem_separator - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ColorGridViewItem_colorIcon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ColorGridViewItem_borderIcon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ColorGridViewItem_checkIcon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ComboBox_button - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressDialog_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressDialog_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataItem_label - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataItem_description - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderElement_touchincrease - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderElement_touchdecrease - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderElement_touchhandle - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderElement_touchgroove - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderTickMark_majoricon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderTickMark_minoricon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderTickMark_majorlabel - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderTickMark_minorlabel - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_QueryInputMode_image - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_GroupBoxHeading_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_GroupBoxHeading_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_GroupBoxMarquee_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_GroupBoxHeading_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_GroupBoxContent_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DataItem_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ItemViewItem_touchmultiselection - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TumbleView_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TumbleView_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_TumbleView_highlight - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DateTimePicker_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DateTimePicker_frame - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_DateTimePicker_separator - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndexFeedback_popu\deprecated P_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_IndexFeedback_popu\deprecated P_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_SliderPopu\deprecated P_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_StatusBar_background - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_StatusBar_timetext - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_InputDialog_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_InputDialog_additionaltext - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSlider_toucharea - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSlider_track - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSliderHandle_icon - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_InputDialog_additionaltext - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_MessageBox_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressSlider_handle - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). - - - \deprecated P_ProgressBar_text - is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). -*/ - // TODO: margins should be defined in layout data once layout specification exists. static const int ItemName = 0xfffe; static const QString STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w"); -static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color"); +static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color.css"); static const int TOUCHAREA_ZVALUE = 1000; static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css"); @@ -799,6 +157,10 @@ static const char* LAYOUT_PTR_PROPERTY = "HbStyle_layout_ptr"; static const char* LAYOUT_NAME_PROPERTY = "HbStyle_layout_name"; +#ifdef HB_TEXT_MEASUREMENT_UTILITY +static const int AUTOMATIC_TEXT_MEASUREMENT = 2; +#endif + inline void overrideSpacing( HbAnchorLayout *layout, const QString &name, Hb::Edge edge, qreal val ) { if( name.isNull() ) { @@ -840,58 +202,61 @@ { delete d_ptr; } - - /*! \deprecated HbStyle::createPrimitive(HbStyle::Primitive, QGraphicsItem*) - is deprecated. This method will be replaced with an altered version which will use new base primitive enumerations. - - Creates instances of primitive graphics items. This method should be used by all widgets that support styling. - When changing the style the returned primitives can be replaced with an altered version of the primitives, or with a completely - different primitive, to create a custom appearance. This shouldn't cause changes to the widget if the functional design - remains the same. - - This method returns HbWidgetBase objects. A widget can store the returned items as HbWidgetBase. If a widget - does not require any functionality from HbWidgetBase then it should store the primitives as QGraphicsItems. - - \note This method is used to replace the conventional Qt-style paint indirection via drawPrimitive. - \sa HbStyle::updatePrimitive method which is to be used in conjunction with this method - \sa HbWidgetBase - \param primitive, to identify the primitive to create - \param parent of the item - \return HbWidgetBase is returned. + is deprecated. This method will be made private and later replaced with new version. */ QGraphicsItem *HbStyle::createPrimitive( HbStyle::Primitive primitive, QGraphicsItem *parent ) const { - + Q_UNUSED(primitive); + Q_UNUSED(parent); + return 0; + +} +/*! +\deprecated HbStyle::updatePrimitive(QGraphicsItem*, HbStyle::Primitive, const QStyleOption*) +is deprecated. This method will be made private and later replaced with a new version. + + */ +void HbStyle::updatePrimitive( QGraphicsItem *item, HbStyle::Primitive primitive, const QStyleOption *option ) const +{ + Q_UNUSED(item); + Q_UNUSED(primitive); + Q_UNUSED(option); +} + + +QGraphicsItem *HbStylePrivate::createPrimitive( HbStylePrivate::Primitive primitive, QGraphicsItem *parent ) +{ + switch (primitive){ case P_MenuItem_submenuindicator: { HbIconItem *item = new HbIconItem(parent); - setItemName(item, QLatin1String("submenu-indicator")); + HbStyle::setItemName(item, QLatin1String("submenu-indicator")); return item; } case P_MenuItem_checkindicator: { HbIconItem *item = new HbIconItem(parent); - setItemName(item, QLatin1String("check-indicator")); + HbStyle::setItemName(item, QLatin1String("check-indicator")); return item; } case P_MenuItem_separator: { HbIconItem *item = new HbIconItem(parent); - setItemName(item, QLatin1String("separator")); + HbStyle::setItemName(item, QLatin1String("separator")); return item; } case P_ToolButton_icon: case P_PushButton_icon: case P_ProgressDialog_icon: { HbIconItem *iconItem = new HbIconItem(HbIcon(),parent); - setItemName(iconItem, QLatin1String("icon")); + HbStyle::setItemName(iconItem, QLatin1String("icon")); return iconItem; } @@ -900,25 +265,25 @@ case P_Label_icon: case P_GridViewItem_icon: { HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent)); - setItemName(item, QLatin1String("icon")); + HbStyle::setItemName(item, QLatin1String("icon")); return item; } case P_DataGroup_icon: { HbIconItem *item = new HbIconItem(HbIcon(), parent); - setItemName(item, QLatin1String("dataGroup_Icon")); + HbStyle::setItemName(item, QLatin1String("dataGroup_Icon")); return item; } case P_DataItem_icon: { HbIconItem *item = new HbIconItem(HbIcon(), parent); - setItemName(item, QLatin1String("dataItem_Icon")); + HbStyle::setItemName(item, QLatin1String("dataItem_Icon")); return item; } case P_ComboBox_text: { HbTextItem *textItem = new HbTextItem(parent); - setItemName(textItem, QLatin1String("combobox_labelfield")); + HbStyle::setItemName(textItem, QLatin1String("combobox_labelfield")); return textItem; } case P_ToolButton_text: @@ -926,51 +291,51 @@ case P_ProgressDialog_text: { HbTextItem *textItem = new HbTextItem(parent); - setItemName(textItem, QLatin1String("text")); + HbStyle::setItemName(textItem, QLatin1String("text")); return textItem; } case P_PushButton_text: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("text")); + HbStyle::setItemName(ti, QLatin1String("text")); return ti; } case P_DataGroup_heading: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("dataGroup_HeadingLabel")); + HbStyle::setItemName(ti, QLatin1String("dataGroup_HeadingLabel")); return ti; } case P_DataGroup_description: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("dataGroup_Description")); + HbStyle::setItemName(ti, QLatin1String("dataGroup_Description")); return ti; } case P_DataForm_heading: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("dataForm_Heading")); + HbStyle::setItemName(ti, QLatin1String("dataForm_Heading")); //ti->setZValue(2); return ti; } case P_DataForm_description: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("dataForm_Desc")); + HbStyle::setItemName(ti, QLatin1String("dataForm_Desc")); return ti; } case P_PushButton_additionaltext: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("additional-text")); + HbStyle::setItemName(ti, QLatin1String("additional-text")); return ti; } case P_ProgressSlider_toucharea: { HbTouchArea *ta = new HbTouchArea(parent); ta->setFlag(QGraphicsItem::ItemIsFocusable); - setItemName(ta, QLatin1String("toucharea")); + HbStyle::setItemName(ta, QLatin1String("toucharea")); ta->setZValue(TOUCHAREA_ZVALUE); return ta; } @@ -978,7 +343,7 @@ { HbTouchArea *ta = new HbTouchArea(parent); ta->setFlag(QGraphicsItem::ItemIsFocusable); - setItemName(ta, QLatin1String("toucharea")); + HbStyle::setItemName(ta, QLatin1String("toucharea")); ta->setZValue(TOUCHAREA_ZVALUE); if(parent){ parent->setFiltersChildEvents(true); @@ -999,7 +364,7 @@ { HbTouchArea *ta = new HbTouchArea(parent); ta->setFlag(QGraphicsItem::ItemIsFocusable); - setItemName(ta, QLatin1String("toucharea")); + HbStyle::setItemName(ta, QLatin1String("toucharea")); if(parent){ parent->setFiltersChildEvents(true); } @@ -1009,7 +374,7 @@ { HbTouchArea *ta = new HbTouchArea(parent); ta->setFlags(QGraphicsItem::ItemIsFocusable); - setItemName(ta, QLatin1String("toucharea")); + HbStyle::setItemName(ta, QLatin1String("toucharea")); // NOTE:: This is a temporary fix //if(parent){ // parent->setHandlesChildEvents(true); @@ -1020,26 +385,40 @@ { HbTouchArea *ta = new HbTouchArea(parent); ta->setFlag(QGraphicsItem::ItemIsFocusable); - setItemName(ta, QLatin1String("combobox_button_toucharea")); + HbStyle::setItemName(ta, QLatin1String("combobox_button_toucharea")); if(parent){ parent->setFiltersChildEvents(true); } return ta; } - case P_TitleBar_toucharea: + case P_TitleBar_toucharea: { HbTouchArea *ta = new HbTouchArea(parent); ta->setFlag(QGraphicsItem::ItemIsFocusable); - setItemName(ta, QLatin1String("toucharea")); + ta->grabGesture(Qt::SwipeGesture); + HbStyle::setItemName(ta, QLatin1String("toucharea")); return ta; } case P_IndicatorButton_toucharea: - case P_TitlePane_toucharea: case P_NavigationButton_toucharea: { HbTouchArea *ta = new HbTouchArea(parent); ta->setFlag(QGraphicsItem::ItemIsFocusable); - setItemName(ta, QLatin1String("toucharea")); + ta->grabGesture(Qt::TapGesture); + HbStyle::setItemName(ta, QLatin1String("toucharea")); + if (parent){ + parent->setHandlesChildEvents(true); + } + return ta; + } + case P_TitlePane_toucharea: + { + HbTouchArea *ta = new HbTouchArea(parent); + ta->setFlag(QGraphicsItem::ItemIsFocusable); + ta->grabGesture(Qt::TapGesture); + ta->grabGesture(Qt::SwipeGesture); + ta->grabGesture(Qt::PanGesture); + HbStyle::setItemName(ta, QLatin1String("toucharea")); if (parent){ parent->setHandlesChildEvents(true); } @@ -1065,30 +444,30 @@ case P_DataItem_label: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("dataItem_Label")); + HbStyle::setItemName(ti, QLatin1String("dataItem_Label")); return ti; } case P_DataItem_description: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("dataItem_Description")); + HbStyle::setItemName(ti, QLatin1String("dataItem_Description")); return ti; } case P_ProgressBar_mintext: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("min-text")); + HbStyle::setItemName(ti, QLatin1String("min-text")); return ti; } case P_ProgressBar_maxtext: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("max-text")); + HbStyle::setItemName(ti, QLatin1String("max-text")); return ti; } case P_Label_text: { HbTextItem *ti = new HbTextItem(parent); - setItemName(ti, QLatin1String("text")); + HbStyle::setItemName(ti, QLatin1String("text")); ti->setAlignment(Qt::AlignCenter); return ti; } @@ -1096,14 +475,14 @@ case P_Label_richtext: { HbRichTextItem *rti = new HbRichTextItem(parent); - setItemName(rti, QLatin1String("text")); + HbStyle::setItemName(rti, QLatin1String("text")); return rti; } case P_MenuItem_text: { HbTextItem *item = new HbTextItem(parent); - setItemName(item, QLatin1String("text")); + HbStyle::setItemName(item, QLatin1String("text")); return item; } @@ -1136,7 +515,7 @@ HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); n->frameDrawer().setFillWholeRect(true); - setItemName(n, "frame"); + HbStyle::setItemName(n, "frame"); return n; } @@ -1144,7 +523,7 @@ { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); - setItemName(n , "dropdown_background"); + HbStyle::setItemName(n , "dropdown_background"); return n; } @@ -1170,28 +549,28 @@ { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("dataGroup_Background")); + HbStyle::setItemName(n, QLatin1String("dataGroup_Background")); return n; } case P_DataGroupComboBackground: { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("dataGroup_ComboBackground")); + HbStyle::setItemName(n, QLatin1String("dataGroup_ComboBackground")); return n; } case P_DataForm_heading_background : { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("dataFormHeading_Background")); + HbStyle::setItemName(n, QLatin1String("dataFormHeading_Background")); return n; } case P_DataItem_background: { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-2); - setItemName(n, QLatin1String("dataItem_Background")); + HbStyle::setItemName(n, QLatin1String("dataItem_Background")); return n; } case P_GroupBoxContent_background: @@ -1200,7 +579,7 @@ { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("background")); + HbStyle::setItemName(n, QLatin1String("background")); return n; } case P_ProgressBar_track: @@ -1226,7 +605,7 @@ { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("background")); + HbStyle::setItemName(n, QLatin1String("background")); return n; } case P_NavigationButton_background: @@ -1234,95 +613,95 @@ { HbIconItem *n = new HbIconItem(HbIcon(), parent); n->setZValue(-1); - setItemName(n, QLatin1String("background")); + HbStyle::setItemName(n, QLatin1String("background")); return n; } case P_IndicatorButton_handleindication: { HbIconItem *n = new HbIconItem(parent); - setItemName(n, QLatin1String("handleindication")); + HbStyle::setItemName(n, QLatin1String("handleindication")); return n; } case P_IndicatorButton_eventindication: { HbIconItem *n = new HbIconItem(parent); n->setFlags(HbIcon::Colorized); - setItemName(n, QLatin1String("eventindication")); + HbStyle::setItemName(n, QLatin1String("eventindication")); return n; } case P_IndicatorGroup_icon1: { HbIconItem *n = new HbIconItem(parent); n->setFlags(HbIcon::Colorized); - setItemName(n, QLatin1String("icon1")); + HbStyle::setItemName(n, QLatin1String("icon1")); return n; } case P_IndicatorGroup_icon2: { HbIconItem *n = new HbIconItem(parent); n->setFlags(HbIcon::Colorized); - setItemName(n, QLatin1String("icon2")); + HbStyle::setItemName(n, QLatin1String("icon2")); return n; } case P_IndicatorGroup_icon3: { HbIconItem *n = new HbIconItem(parent); n->setFlags(HbIcon::Colorized); - setItemName(n, QLatin1String("icon3")); + HbStyle::setItemName(n, QLatin1String("icon3")); return n; } case P_IndicatorGroup_icon4: { HbIconItem *n = new HbIconItem(parent); n->setFlags(HbIcon::Colorized); - setItemName(n, QLatin1String("icon4")); + HbStyle::setItemName(n, QLatin1String("icon4")); return n; } case P_SignalIndicator_icon: { HbIconItem *n = new HbIconItem(parent); n->setFlags(HbIcon::Colorized); - setItemName(n, QLatin1String("icon")); + HbStyle::setItemName(n, QLatin1String("icon")); return n; } case P_SignalLevel_background: { HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("background")); + HbStyle::setItemName(n, QLatin1String("background")); return n; } case P_SignalLevel_icon: { HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); - setItemName(n, QLatin1String("levelicon")); + HbStyle::setItemName(n, QLatin1String("levelicon")); return n; } case P_BatteryIndicator_icon: { HbIconItem *n = new HbIconItem(parent); n->setFlags(HbIcon::Colorized); - setItemName(n, QLatin1String("icon")); + HbStyle::setItemName(n, QLatin1String("icon")); return n; } case P_BatteryLevel_background: { HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("background")); + HbStyle::setItemName(n, QLatin1String("background")); return n; } case P_BatteryLevel_icon: { HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); - setItemName(n, QLatin1String("levelicon")); + HbStyle::setItemName(n, QLatin1String("levelicon")); return n; } case P_TitlePane_background: { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("background")); + HbStyle::setItemName(n, QLatin1String("background")); return n; } case P_LineEdit_frame_normal: @@ -1338,27 +717,27 @@ case P_TitlePane_text: { HbMarqueeItem *n = new HbMarqueeItem(parent); - setItemName(n, QLatin1String("text")); + HbStyle::setItemName(n, QLatin1String("text")); return n; } case P_TitlePane_icon: { HbIconItem *n = new HbIconItem(parent); n->setFlags(HbIcon::Colorized); - setItemName(n, QLatin1String("icon")); + HbStyle::setItemName(n, QLatin1String("icon")); return n; } case P_StatusBar_background: { HbFrameItem *n = new HbFrameItem(parent); n->setZValue(-1); - setItemName(n, QLatin1String("background")); + HbStyle::setItemName(n, QLatin1String("background")); return n; } case P_StatusBar_timetext: { HbTextItem *textItem = new HbTextItem(parent); - setItemName(textItem, QLatin1String("timetext")); + HbStyle::setItemName(textItem, QLatin1String("timetext")); textItem->setAlignment(Qt::AlignCenter); return textItem; } @@ -1371,22 +750,22 @@ case P_SliderTickMark_majoricon: { HbIconItem *iconItem = new HbIconItem(parent); - setItemName(iconItem,QLatin1String("tickmark-majoricon")); + HbStyle::setItemName(iconItem,QLatin1String("tickmark-majoricon")); return iconItem; } case P_SliderTickMark_minoricon: { HbIconItem *iconItem = new HbIconItem(parent); - setItemName(iconItem,QLatin1String("tickmark-minoricon")); + HbStyle::setItemName(iconItem,QLatin1String("tickmark-minoricon")); return iconItem; } case P_SliderTickMark_majorlabel: { HbTextItem *textItem = new HbTextItem(parent); - setItemName(textItem,QLatin1String("tickmark-majorlabel")); + HbStyle::setItemName(textItem,QLatin1String("tickmark-majorlabel")); return textItem; } case P_SliderTickMark_minorlabel: { HbTextItem *textItem = new HbTextItem(parent); - setItemName(textItem,QLatin1String("tickmark-minorlabel")); + HbStyle::setItemName(textItem,QLatin1String("tickmark-minorlabel")); return textItem; } @@ -1401,21 +780,21 @@ case P_RatingSlider_layout: { HbWidgetBase *layout = new HbWidgetBase(parent); - setItemName(layout, "frame"); + HbStyle::setItemName(layout, "frame"); return layout; } case P_ItemViewItem_checkbox: { qDebug() << "Primitive P_ItemViewItem_checkbox is deprecated and will cease to exist in the near future."; HbIconItem *iconItem = new HbIconItem(parent); - setItemName(iconItem, QLatin1String("checkbox-icon")); + HbStyle::setItemName(iconItem, QLatin1String("checkbox-icon")); return iconItem; } case P_ItemViewItem_radiobutton: case P_ItemViewItem_selection: { HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent)); - setItemName(iconItem, QLatin1String("selection-icon")); + HbStyle::setItemName(iconItem, QLatin1String("selection-icon")); return iconItem; } @@ -1425,7 +804,7 @@ case P_GroupBoxHeading_text: case P_NotificationDialog_text:{ HbTextItem *n = new HbTextItem(parent); - setItemName(n, QLatin1String("text")); + HbStyle::setItemName(n, QLatin1String("text")); n->setMinimumLines(1); n->setMaximumLines(1); n->setTextWrapping(Hb::TextNoWrap); @@ -1433,12 +812,12 @@ } case P_NotificationDialog_title:{ HbTextItem *n = new HbTextItem(parent); - setItemName(n, QLatin1String("title")); + HbStyle::setItemName(n, QLatin1String("title")); return n; } case P_NotificationDialog_icon:{ HbIconItem *n = new HbIconItem(QString(), parent); - setItemName(n, QLatin1String("icon")); + HbStyle::setItemName(n, QLatin1String("icon")); return n; } case P_MessageBox_text:{ //deprecated @@ -1453,7 +832,8 @@ case P_ItemViewItem_background: { HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent)); iconItem->setZValue(-3.0); - setItemName(iconItem, QLatin1String("background")); + HbStyle::setItemName(iconItem, QLatin1String("background")); + iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); return iconItem; } @@ -1472,7 +852,7 @@ HbTextItem *textItem = q_check_ptr(new HbTextItem(parent)); // caching do not work properly - text is not refreshed immediatelly //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); - setItemName(textItem, QLatin1String("text")); + HbStyle::setItemName(textItem, QLatin1String("text")); return textItem; } @@ -1488,7 +868,7 @@ case P_TreeViewItem_expandicon: { HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent)); - setItemName(iconItem, QLatin1String("subitem-indicator")); + HbStyle::setItemName(iconItem, QLatin1String("subitem-indicator")); return iconItem; } @@ -1507,7 +887,7 @@ qWarning("Unknown HbSelectionControl primitive %i", primitive); break; } - setItemName(iconItem, QLatin1String("handle-icon")); + HbStyle::setItemName(iconItem, QLatin1String("handle-icon")); return iconItem; } case P_ComboBox_button: { @@ -1525,41 +905,41 @@ case P_ItemViewItem_frame: { HbFrameItem *item = q_check_ptr(new HbFrameItem(parent)); item->setZValue(-4.0); - setItemName(item,"frame"); + HbStyle::setItemName(item,"frame"); return item; } case P_ScrollArea_continuationbottom: { HbFrameItem *n = new HbFrameItem(parent); - setItemName(n, QLatin1String("continuation-indicator-bottom")); + HbStyle::setItemName(n, QLatin1String("continuation-indicator-bottom")); n->setZValue(-1); return n; } case P_ScrollArea_continuationtop: { HbFrameItem *n = new HbFrameItem(parent); - setItemName(n, QLatin1String("continuation-indicator-top")); + HbStyle::setItemName(n, QLatin1String("continuation-indicator-top")); n->setZValue(-1); return n; } case P_ScrollArea_continuationleft: { HbFrameItem *n = new HbFrameItem(parent); - setItemName(n, QLatin1String("continuation-indicator-left")); + HbStyle::setItemName(n, QLatin1String("continuation-indicator-left")); n->setZValue(-1); return n; } case P_ScrollArea_continuationright: { HbFrameItem *n = new HbFrameItem(parent); - setItemName(n, QLatin1String("continuation-indicator-right")); + HbStyle::setItemName(n, QLatin1String("continuation-indicator-right")); n->setZValue(-1); return n; } case P_ItemViewItem_touchmultiselection: { HbTouchArea *area = q_check_ptr(new HbTouchArea(parent)); - setItemName(area, "multiselection-toucharea"); + HbStyle::setItemName(area, "multiselection-toucharea"); return area; } case P_IndexFeedback_popup_text: @@ -1567,7 +947,7 @@ HbTextItem *textItem = new HbTextItem(parent); textItem->setAlignment(Qt::AlignCenter); textItem->setTextWrapping(Hb::TextNoWrap); - setItemName(textItem, QLatin1String("index-text")); + HbStyle::setItemName(textItem, QLatin1String("index-text")); //TODO:: make this a sane value textItem->setZValue(4); @@ -1575,26 +955,27 @@ } case P_IndexFeedback_popup_background: { + HbFrameItem *n = new HbFrameItem(parent); n->frameDrawer().setFrameGraphicsName("qtg_fr_popup_preview"); n->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); qreal cornerPieceSize = 0; - parameter(QLatin1String("hb-param-background-popup-preview"),cornerPieceSize); + hbInstance->style()->parameter(QLatin1String("hb-param-background-popup-preview"),cornerPieceSize); n->frameDrawer().setBorderWidths(cornerPieceSize, cornerPieceSize); - setItemName(n, QLatin1String("index-background")); + HbStyle::setItemName(n, QLatin1String("index-background")); n->setZValue(3); return n; } case P_InputDialog_text: { HbTextItem *n = new HbTextItem(parent); - setItemName(n, QLatin1String("label-1")); + HbStyle::setItemName(n, QLatin1String("label-1")); return n; } case P_InputDialog_additionaltext: { HbTextItem *n = new HbTextItem(parent); - setItemName(n, QLatin1String("label-2")); + HbStyle::setItemName(n, QLatin1String("label-2")); return n; } default: @@ -1602,28 +983,9 @@ } } -/*! - - \deprecated HbStyle::updatePrimitive(QGraphicsItem*, HbStyle::Primitive, const QStyleOption*) - is deprecated. This method will be made private and finally removed since primitive updating will be done in the widgets. - - Updates the state and content of widget's child primitives. Update for a styled primitive should happen always when - a state change that affects drawing occurs. Such a situation can be for example pressing of a button (change background image), or - changing a text for a widget having text content. The updatePrimitive() implementation for each primitive element can be considered - as a part of widget's implementation. Note that it's up to the widget to decide what the styleoption contains and what the updatePrimitive() method - uses the styleoption data for. - - \sa HbStyle::createPrimitive - \param item Primitive graphicsitem. - \param primitive To identify the primitive to create. - \param option Style option, contains all the information needed to update the primitive, this - information is widget specific and each widget usually has a styleoption. Styleoption may include - information about the widget's state, content etc. - */ -void HbStyle::updatePrimitive( QGraphicsItem *item, HbStyle::Primitive primitive, const QStyleOption *option ) const +void HbStylePrivate::updatePrimitive( QGraphicsItem *item, HbStylePrivate::Primitive primitive, const QStyleOption *option ) { - Q_D( const HbStyle ); - + switch(primitive){ case P_PushButton_icon: { @@ -1632,8 +994,8 @@ HbIconItem *iconItem = static_cast(item); //iconItem->setIconName(opt->icon.iconName()); iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there - iconItem->setMode(d->iconMode(opt->state)); - iconItem->setState(d->iconState(opt->state)); + iconItem->setMode(iconMode(opt->state)); + iconItem->setState(iconState(opt->state)); iconItem->setAlignment(Qt::AlignCenter); } break; @@ -1676,8 +1038,8 @@ HbIconItem *iconItem = static_cast(item); iconItem->setIcon(opt->icon); if (!opt->icon.isNull()) { - iconItem->setMode(d->iconMode(opt->state)); - iconItem->setState(d->iconState(opt->state)); + iconItem->setMode(iconMode(opt->state)); + iconItem->setState(iconState(opt->state)); iconItem->setAspectRatioMode(opt->aspectRatioMode); iconItem->setAlignment(opt->alignment); } @@ -1687,8 +1049,8 @@ if (const HbStyleOptionToolButton *opt = qstyleoption_cast(option)) { HbIconItem *iconItem = static_cast(item); iconItem->setIcon(opt->icon); - iconItem->setMode(d->iconMode(opt->state)); - iconItem->setState(d->iconState(opt->state)); + iconItem->setMode(iconMode(opt->state)); + iconItem->setState(iconState(opt->state)); } break; case P_ComboBox_text: @@ -1835,21 +1197,20 @@ } if (opt->state & QStyle::State_Active) { mode = QIcon::Active; - } + } if (opt->state & QStyle::State_Selected) { mode = QIcon::Selected; } frameItem->setZValue(-1.0); if(mode == QIcon::Disabled) { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_disabled")); - } + } else if(opt->pressed ) { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_pressed")); } else { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_parent_normal")); } frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); - frameItem->setGeometry(opt->rect); } break; } @@ -1934,7 +1295,7 @@ HbFrameItem *frameItem = static_cast( item ); if(!frameItem){ return; - } + } QIcon::Mode mode = QIcon::Disabled; if (opt->state & QStyle::State_Enabled) { mode = QIcon::Normal; @@ -2092,7 +1453,7 @@ break; } - case P_IndicatorButton_eventindication: { + case P_IndicatorButton_eventindication: { const HbStyleOptionIndicatorButton *opt = qstyleoption_cast(option); if (opt) { HbIconItem *iconItem = static_cast(item); @@ -2263,6 +1624,7 @@ iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l")); } } + iconItem->update(); } break; } @@ -2271,9 +1633,12 @@ const HbStyleOptionTitlePane *opt = qstyleoption_cast(option); if (opt) { - HbMarqueeItem *marqueeItem = static_cast( item ); + HbMarqueeItem *marqueeItem = static_cast(item); if (marqueeItem) { marqueeItem->setText(opt->caption); + if (opt->margueeAnimation) { + marqueeItem->startAnimation(); + } } } break; @@ -2338,8 +1703,8 @@ QStringList list; QString frameGraphicsFooter; - QIcon::Mode mode = d->iconMode(opt->state); - QIcon::State state = d->iconState(opt->state); + QIcon::Mode mode = iconMode(opt->state); + QIcon::State state = iconState(opt->state); if (!opt->customBackground.isNull()) { QString customName = opt->customBackground.iconName(mode, state); @@ -2456,13 +1821,13 @@ if (const HbStyleOptionSlider *opt = qstyleoption_cast(option)) { HbIconItem *iconItem = qgraphicsitem_cast(item); - iconItem->setMode(d->iconMode(opt->state)); + iconItem->setMode(iconMode(opt->state)); if ( opt->orientation ==Qt::Horizontal ){ iconItem->setIconName( "qtg_graf_slider_h_tick_major" ); } else { iconItem->setIconName ( "qtg_graf_slider_v_tick_major" ); } - iconItem->setState(d->iconState(opt->state)); + iconItem->setState(iconState(opt->state)); } break; @@ -2472,13 +1837,13 @@ if (const HbStyleOptionSlider *opt = qstyleoption_cast(option)) { HbIconItem *iconItem = qgraphicsitem_cast(item); - iconItem->setMode(d->iconMode(opt->state)); + iconItem->setMode(iconMode(opt->state)); if ( opt->orientation ==Qt::Horizontal ){ iconItem->setIconName( "qtg_graf_slider_h_tick_minor" ); } else { iconItem->setIconName ( "qtg_graf_slider_v_tick_minor" ); } - iconItem->setState(d->iconState(opt->state)); + iconItem->setState(iconState(opt->state)); } break; @@ -2562,7 +1927,7 @@ } } else { name = QLatin1String("qtg_fr_slider_v_frame_disabled"); - + } type = HbFrameDrawer::ThreePiecesVertical; } @@ -2581,7 +1946,7 @@ QString thumbPath; if(opt->thumbPath.isNull()) { - thumbPath=d->logicalName(HbStyle::P_Slider_thumb, option); + thumbPath=logicalName(HbStylePrivate::P_Slider_thumb, option); } else { @@ -2593,13 +1958,13 @@ } break; } - case HbStyle::P_SliderElement_increase: + case HbStylePrivate::P_SliderElement_increase: { if (const HbStyleOptionSlider *opt = qstyleoption_cast(option)) { HbIconItem *iconItem = static_cast(item); iconItem->setZValue(1.0); - iconItem->setMode(d->iconMode(opt->state)); - iconItem->setState(d->iconState(opt->state)); + iconItem->setMode(iconMode(opt->state)); + iconItem->setState(iconState(opt->state)); if ( !opt->sliderElementIcon.isNull() ){ iconItem->setIcon(opt->sliderElementIcon); } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { @@ -2610,13 +1975,13 @@ } break; } - case HbStyle::P_SliderElement_decrease: + case HbStylePrivate::P_SliderElement_decrease: { if (const HbStyleOptionSlider *opt = qstyleoption_cast(option)) { HbIconItem *iconItem = static_cast(item); iconItem->setZValue(1.0); - iconItem->setMode(d->iconMode(opt->state)); - iconItem->setState(d->iconState(opt->state)); + iconItem->setMode(iconMode(opt->state)); + iconItem->setState(iconState(opt->state)); if ( !opt->sliderElementIcon.isNull() ){ iconItem->setIcon(opt->sliderElementIcon); } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { @@ -2627,13 +1992,13 @@ } break; } - case HbStyle::P_SliderElement_icon: + case HbStylePrivate::P_SliderElement_icon: { if (const HbStyleOptionSlider *opt = qstyleoption_cast(option)) { HbIconItem *iconItem = static_cast(item); iconItem->setZValue(1.0); - iconItem->setMode(d->iconMode(opt->state)); - iconItem->setState(d->iconState(opt->state)); + iconItem->setMode(iconMode(opt->state)); + iconItem->setState(iconState(opt->state)); if ( !opt->sliderElementIcon.isNull() ){ iconItem->setIcon(opt->sliderElementIcon); } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { @@ -2737,7 +2102,12 @@ case P_LineEdit_frame_normal:{ if (HbFrameItem *frameItem = qgraphicsitem_cast( item ) ) { - frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_normal")); + if(frameItem->isEnabled()) { + qDebug() << "Update primitive bagckground enabled"; + frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_normal")); + } else { + frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_lineedit_disabled")); + } frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); } break; @@ -2756,7 +2126,11 @@ case P_TextEdit_frame_normal:{ if (HbFrameItem *frameItem = qgraphicsitem_cast( item ) ) { - frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_normal")); + if(frameItem->isEnabled()) { + frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_normal")); + } else { + frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_textedit_disabled")); + } frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); } break; @@ -2844,6 +2218,7 @@ textItem->setTextColor(opt->color); } textItem->setText(opt->text); + textItem->setMaximumLines(opt->maximumLines); } break; case P_Label_richtext: @@ -2991,15 +2366,13 @@ } break; - case P_ComboBoxPopup_background: - if (const HbStyleOption *opt = qstyleoption_cast(option)) { + case P_ComboBoxPopup_background: { HbFrameItem *frameItem = static_cast(item); - if(!frameItem){ + if(!frameItem){ return; - } + } frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_secondary")); - frameItem->setGeometry(opt->boundingRect); } break; @@ -3128,10 +2501,10 @@ // min & max secondary text row counts not set by app. Allow setting those from .css // Needed when multilineSecondaryTextSupported changed from FALSE to TRUE and // min & max secondary text row counts has not bee set by app - HbWidgetBasePrivate *widgetBasePrivate = d->widgetBasePrivate(textItem); - widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false); - widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false); - widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); + HbWidgetBasePrivate *widgetBaseP = widgetBasePrivate(textItem); + widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false); + widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false); + widgetBaseP->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); } } else { // min & max secondary text row counts must always be 1. They cannot be overridden by .css @@ -3140,7 +2513,18 @@ textItem->setMaximumLines(1); } } // else - default values from .css still in use - setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1)); + + // Below optimizes the most common cases. + if (opt->index == 0) { + HbStyle::setItemName(textItem, QLatin1String("text-1")); + } else if (opt->index == 1) { + HbStyle::setItemName(textItem, QLatin1String("text-2")); + } else if (opt->index == 2) { + HbStyle::setItemName(textItem, QLatin1String("text-3")); + } else { + HbStyle::setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1)); + } + textItem->setText(opt->content.value()); } break; @@ -3149,14 +2533,31 @@ HbRichTextItem *label = static_cast(item); label->setText(opt->content.value()); - setItemName(label, QLatin1String("text-") + QString::number(opt->index + 1)); + // Below optimizes the most common cases. + if (opt->index == 0) { + HbStyle::setItemName(label, QLatin1String("text-1")); + } else if (opt->index == 1) { + HbStyle::setItemName(label, QLatin1String("text-2")); + } else if (opt->index == 2) { + HbStyle::setItemName(label, QLatin1String("text-3")); + } else { + HbStyle::setItemName(label, QLatin1String("text-") + QString::number(opt->index + 1)); + } } break; case P_ListViewItem_icon: if (const HbStyleOptionListViewItem *opt = qstyleoption_cast(option)) { HbIconItem *iconItem = static_cast(item); - setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1)); + // Below optimizes the most common cases. + if (opt->index == 0) { + HbStyle::setItemName(iconItem, QLatin1String("icon-1")); + } else if (opt->index == 1) { + HbStyle::setItemName(iconItem, QLatin1String("icon-2")); + } else { + HbStyle::setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1)); + } + if (iconItem->zValue() != opt->index + 1) { iconItem->setZValue(opt->index + 1); } @@ -3245,10 +2646,10 @@ HbFrameItem *frameItem = static_cast(item); frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); if(opt->orientation == Qt::Horizontal){ - + frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_frame")); } - + else{ frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_frame")); @@ -3263,7 +2664,7 @@ if(!frameItem->isVisible()) { break; } - + if(opt->orientation == Qt::Horizontal){ frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_filled")); @@ -3272,7 +2673,7 @@ frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_filled")); } - + frameItem->setMaximum(opt->maximum); frameItem->setMinimum(opt->minimum); frameItem->setValue(opt->progressValue); @@ -3305,17 +2706,17 @@ if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast(option)) { HbFrameItem *frameItem = static_cast(item); frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); - if (opt->disableState ) { + if (opt->disableState ) { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled")); - } - else { - if(opt->pressedState) { + } + else { + if(opt->pressedState) { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed")); } else { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal")); } - } + } frameItem->frameDrawer().setFillWholeRect(true); //frameItem->update(); } @@ -3325,12 +2726,12 @@ HbProgressTrackItem* frameItem = static_cast(item); frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); - if (opt->disableState ) { + if (opt->disableState ) { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded_disabled")); - } - else { + } + else { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded")); - } + } frameItem->frameDrawer().setFillWholeRect(true); frameItem->setMaximum(opt->maximum); frameItem->setMinimum(opt->minimum); @@ -3345,12 +2746,12 @@ if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast(option)) { HbProgressTrackItem* frameItem = static_cast(item); frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); - if (opt->disableState ) { + if (opt->disableState ) { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played_disabled")); - } - else { + } + else { frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played")); - } + } frameItem->frameDrawer().setFillWholeRect(true); frameItem->setMaximum(opt->maximum); frameItem->setMinimum(opt->minimum); @@ -3399,14 +2800,14 @@ } else { - if(opt->pressedState) { - - repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_pressed")); - } - else { - - repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated")); - } + if(opt->pressedState) { + + repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_pressed")); + } + else { + + repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated")); + } } } repeatItem->setGeometry(opt->boundingRect); @@ -3433,13 +2834,13 @@ } else { - if(opt->pressedState) { - - repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_pressed")); - } - else { - repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated")); - } + if(opt->pressedState) { + + repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_pressed")); + } + else { + repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated")); + } } } repeatItem->setGeometry(opt->boundingRect); @@ -3545,7 +2946,7 @@ frameItem->frameDrawer().setFrameGraphicsName(opt->insidePopup ? QLatin1String("qtg_fr_popup_grid_pressed") : QLatin1String("qtg_fr_grid_pressed")); } else { - setItemName(frameItem,QString()); + HbStyle::setItemName(frameItem,QString()); frameItem->frameDrawer().setFrameGraphicsName(QString()); } } @@ -3610,7 +3011,7 @@ className = obj->className(); } /////////////////////////////////////////////////////////// - + if( !className.compare("HbTumbleView") ){ frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg"); } @@ -3644,7 +3045,7 @@ if(HbFrameItem *frameItem = qgraphicsitem_cast(item)) { frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri"); frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); - frameItem->setZValue(3); + frameItem->setZValue(-1); //TODO:temp fix, issue with css rule picking in derived class //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); @@ -4163,7 +3564,7 @@ This method reads the CSS and WidgetML definition for a given widget and positions the sub-elements inside it. Note you need to set the names for the sub-elements - with HbStyle::setItemName method before this method is called. + with HbStyle::HbStyle::setItemName method before this method is called. Note that this method is heavy on the system resources and should be called absolutely when necessary by the widget. @@ -4219,7 +3620,7 @@ #ifdef HBSTYLE_DEBUG qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count(); #endif - d->ensureLayoutParameters(profile); + d->layoutParameters.init(profile); HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile); QString layoutName; @@ -4318,6 +3719,13 @@ } } } + +#ifdef HB_TEXT_MEASUREMENT_UTILITY + if ( d->mAutomaticTextMeasurementEnabled ) { + HbInstancePrivate::d_ptr()->startLocalizationMeasurement(); + } +#endif // HB_TEXT_MEASUREMENT_UTILITY + } /*! @@ -4500,9 +3908,6 @@ if( name.isEmpty() ) { layout->removeMapping(originalName); } else { - if ( !originalName.isEmpty() ) { - layout->removeMapping(originalName); - } layout->setMapping(lItem, name); } } @@ -4545,7 +3950,7 @@ effectiveProfile = HbDeviceProfile::current(); } Q_D( const HbStyle ); - d->ensureLayoutParameters(effectiveProfile); + d->layoutParameters.init(effectiveProfile); HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile); // todo: parsing variable/expression is done here so that there is no need to change API // also parameters method not changed (this change is done for docml/widgetml parsing) @@ -4589,13 +3994,14 @@ } Q_D( const HbStyle ); - d->ensureLayoutParameters(effectiveProfile); + d->layoutParameters.init(effectiveProfile); HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile); qreal value = 0; - QHash::const_iterator i = d->layoutParameters.constBegin(); + HbLayoutParameters::const_iterator i = d->layoutParameters.constBegin(); while (i != d->layoutParameters.constEnd()) { - if (valueExtractor.extractVariableValue(i.key(), value)) { - params.addParameter(i.key(), value); + QString name(d->layoutParameters.name(i)); + if (valueExtractor.extractVariableValue(name, value)) { + params.addParameter(name, value); } ++i; } @@ -4645,7 +4051,7 @@ #ifdef HBSTYLE_DEBUG qDebug() << "HbStyle::widgetParameters : Number of matching CSS declarations: " << decl.count(); #endif - d->ensureLayoutParameters(profile); + d->layoutParameters.init(profile); HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile); extractor.extractCustomProperties( params.keys(), params.values() ); @@ -4655,7 +4061,7 @@ /*! \internal */ -HbStylePrivate::HbStylePrivate() +HbStylePrivate::HbStylePrivate() : mAutomaticTextMeasurementEnabled(false) { HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance(); if(loader){ @@ -4664,6 +4070,11 @@ loader->addFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors, HbLayeredStyleLoader::Priority_Core); } + +#ifdef HB_TEXT_MEASUREMENT_UTILITY + mAutomaticTextMeasurementEnabled = (HbFeatureManager::instance()->featureStatus(HbFeatureManager::TextMeasurement) == + AUTOMATIC_TEXT_MEASUREMENT); +#endif } /*! @@ -4671,8 +4082,6 @@ */ HbStylePrivate::~HbStylePrivate() { - layoutParameters.clear(); - HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance(); if(loader){ loader->removeFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts, @@ -4685,11 +4094,11 @@ /*! \internal */ -QString HbStylePrivate::logicalName(HbStyle::Primitive primitive, const QStyleOption *option) const +QString HbStylePrivate::logicalName(HbStylePrivate::Primitive primitive, const QStyleOption *option) { switch (primitive) { - case HbStyle::P_Slider_thumb: { + case HbStylePrivate::P_Slider_thumb: { const HbStyleOptionSlider *opt = qstyleoption_cast(option); if (opt) { QString iconPath; @@ -4727,7 +4136,7 @@ /*! \internal */ -QIcon::Mode HbStylePrivate::iconMode(QStyle::State state) const +QIcon::Mode HbStylePrivate::iconMode(QStyle::State state) { QIcon::Mode mode = QIcon::Disabled; if (state & QStyle::State_Enabled) @@ -4742,7 +4151,7 @@ /*! \internal */ -QIcon::State HbStylePrivate::iconState(QStyle::State state) const +QIcon::State HbStylePrivate::iconState(QStyle::State state) { QIcon::State icon = QIcon::Off; if (state & QStyle::State_On) @@ -4750,74 +4159,6 @@ return icon; } - -/*! -\internal -*/ -void HbStylePrivate::ensureLayoutParameters(const HbDeviceProfile &profile) const -{ - bool firstParse(layoutParameters.isEmpty()); - bool addSpecialParams(firstParse); - if (firstParse) { - HbCss::Parser parser; - parser.init(GLOBAL_PARAMETERS_LOCATION, true); - HbCss::StyleSheet *styleSheet = HbMemoryUtils::create(HbMemoryManager::HeapMemory); - parser.parse(styleSheet); - - HbStyleSelector selector; - selector.styleSheets.append(styleSheet); - selector.variableRuleSets(&layoutParameters); - } - if (!firstParse && (layoutParametersProfileName != profile.name())) { - addSpecialParams = true; - } - if (addSpecialParams) { - layoutParametersProfileName = profile.name(); - QSizeF pSize = profile.logicalSize(); - - { - HbCss::Declaration decl; - decl.property = "hb-param-screen-width"; - decl.propertyId = HbCss::Property_Unknown; - HbCss::Value val; - val.type = HbCss::Value::Number; - val.variant = HbVariant((double)pSize.width(),HbMemoryManager::HeapMemory); - decl.values.append(val); - layoutParameters.insert(decl.property, decl); - } - { - HbCss::Declaration decl; - decl.property = "hb-param-screen-height"; - decl.propertyId = HbCss::Property_Unknown; - HbCss::Value val; - val.type = HbCss::Value::Number; - val.variant = HbVariant((double)pSize.height(),HbMemoryManager::HeapMemory); - decl.values.append(val); - layoutParameters.insert(decl.property, decl); - } - { - HbCss::Declaration decl; - decl.property = "hb-param-screen-short-edge"; - decl.propertyId = HbCss::Property_Unknown; - HbCss::Value val; - val.type = HbCss::Value::Number; - val.variant = HbVariant((double)qMin(pSize.height(),pSize.width()),HbMemoryManager::HeapMemory); - decl.values.append(val); - layoutParameters.insert(decl.property, decl); - } - { - HbCss::Declaration decl; - decl.property = "hb-param-screen-long-edge"; - decl.propertyId = HbCss::Property_Unknown; - HbCss::Value val; - val.type = HbCss::Value::Number; - val.variant = HbVariant((double)qMax(pSize.height(),pSize.width()),HbMemoryManager::HeapMemory); - decl.values.append(val); - layoutParameters.insert(decl.property, decl); - } - } -} - /*! \internal */ @@ -4826,7 +4167,7 @@ styleRulesCache.clear(); } -HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase) const +HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase) { return HbWidgetBasePrivate::d_ptr(widgetBase); }