132 Whenever the widget's state changes in a way that needs changes in drawing the primitive |
135 Whenever the widget's state changes in a way that needs changes in drawing the primitive |
133 (such as button pressed down -> change the button background image) then the widget needs to |
136 (such as button pressed down -> change the button background image) then the widget needs to |
134 call the updatePrimitive method. |
137 call the updatePrimitive method. |
135 |
138 |
136 Generally primitives should be updated only when a state change occurs. When a widget uses primitives to construct |
139 Generally primitives should be updated only when a state change occurs. When a widget uses primitives to construct |
137 itself it does not need a paint() method at all since primitives (widget's children) are doing the drawing. |
140 itself it does not need a paint() method at all since primitives (widget's children) are doing the drawing. |
138 Painting for the primitives occurs from the graphics scene. |
141 Painting for the primitives occurs from the graphics scene. |
139 |
142 |
140 HbStyle has some caching functionality and thus it should not be instantiated explicitly, but |
143 HbStyle has some caching functionality and thus it should not be instantiated explicitly, but |
141 accessed only through HbWidget::style() or HbInstance::style() APIs. |
144 accessed only through HbWidget::style() or HbInstance::style() APIs. |
142 |
145 |
143 */ |
146 */ |
144 |
147 |
145 /*! |
|
146 |
|
147 \deprecated P_PushButton_icon |
|
148 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
149 |
|
150 |
|
151 \deprecated P_PushButton_text |
|
152 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
153 |
|
154 |
|
155 \deprecated P_PushButton_additionaltext |
|
156 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
157 |
|
158 |
|
159 \deprecated P_PushButton_background |
|
160 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
161 |
|
162 |
|
163 \deprecated P_PushButton_toucharea |
|
164 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
165 |
|
166 |
|
167 \deprecated P_PushButton_focus |
|
168 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
169 |
|
170 |
|
171 \deprecated P_DataGrou\deprecated P_background |
|
172 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
173 |
|
174 |
|
175 \deprecated P_DataGroupComboBackground |
|
176 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
177 |
|
178 |
|
179 \deprecated P_DataGrou\deprecated P_heading |
|
180 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
181 |
|
182 |
|
183 \deprecated P_DataGrou\deprecated P_description |
|
184 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
185 |
|
186 |
|
187 \deprecated P_DataForm_heading |
|
188 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
189 |
|
190 |
|
191 \deprecated P_DataForm_heading_background |
|
192 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
193 |
|
194 |
|
195 \deprecated P_DataForm_description |
|
196 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
197 |
|
198 |
|
199 \deprecated P_DataGrou\deprecated P_icon |
|
200 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
201 |
|
202 |
|
203 \deprecated P_ToolButton_frame |
|
204 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
205 |
|
206 |
|
207 \deprecated P_ToolButton_text |
|
208 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
209 |
|
210 |
|
211 \deprecated P_ToolButton_icon |
|
212 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
213 |
|
214 |
|
215 \deprecated P_Slider_thumb |
|
216 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
217 |
|
218 |
|
219 \deprecated P_SliderElement_text |
|
220 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
221 |
|
222 |
|
223 \deprecated P_SliderElement_icon |
|
224 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
225 |
|
226 |
|
227 \deprecated P_SliderElement_increase |
|
228 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
229 |
|
230 |
|
231 \deprecated P_SliderElement_decrease |
|
232 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
233 |
|
234 |
|
235 \deprecated P_Slider_groove |
|
236 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
237 |
|
238 |
|
239 \deprecated P_Slider_progressgroove |
|
240 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
241 |
|
242 |
|
243 \deprecated P_ItemViewItem_checkbox |
|
244 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
245 |
|
246 |
|
247 \deprecated P_ItemViewItem_radiobutton |
|
248 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
249 |
|
250 |
|
251 \deprecated P_ItemViewItem_selection |
|
252 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
253 |
|
254 |
|
255 \deprecated P_LineEdit_frame_normal |
|
256 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
257 |
|
258 |
|
259 \deprecated P_LineEdit_frame_highlight |
|
260 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
261 |
|
262 |
|
263 \deprecated P_TextEdit_frame_normal |
|
264 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
265 |
|
266 |
|
267 \deprecated P_TextEdit_frame_highlight |
|
268 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
269 |
|
270 |
|
271 \deprecated P_Edit_text |
|
272 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
273 |
|
274 |
|
275 \deprecated P_Label_text |
|
276 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
277 |
|
278 |
|
279 \deprecated P_Label_icon |
|
280 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
281 |
|
282 |
|
283 \deprecated P_MenuItem_frame |
|
284 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
285 |
|
286 |
|
287 \deprecated P_MenuItem_focus |
|
288 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
289 |
|
290 |
|
291 \deprecated P_MenuItem_text |
|
292 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
293 |
|
294 |
|
295 \deprecated P_MenuItem_submenuindicator |
|
296 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
297 |
|
298 |
|
299 \deprecated P_MenuItem_checkindicator |
|
300 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
301 |
|
302 |
|
303 \deprecated P_MenuItem_separator |
|
304 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
305 |
|
306 |
|
307 \deprecated P_ScrollBar_groove |
|
308 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
309 |
|
310 |
|
311 \deprecated P_ScrollBar_handle |
|
312 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
313 |
|
314 |
|
315 \deprecated P_ScrollBar_toucharea |
|
316 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
317 |
|
318 |
|
319 \deprecated P_Popu\deprecated P_background |
|
320 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
321 |
|
322 |
|
323 \deprecated P_Popu\deprecated P_background_weak |
|
324 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
325 |
|
326 |
|
327 \deprecated P_Popu\deprecated P_heading_frame |
|
328 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
329 |
|
330 |
|
331 \deprecated P_ToolTi\deprecated P_background |
|
332 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
333 |
|
334 |
|
335 \deprecated P_MessageBox_icon |
|
336 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
337 |
|
338 |
|
339 \deprecated P_ItemViewItem_background |
|
340 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
341 |
|
342 |
|
343 \deprecated P_ListViewItem_text |
|
344 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
345 |
|
346 |
|
347 \deprecated P_ListViewItem_richtext |
|
348 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
349 |
|
350 |
|
351 \deprecated P_ListViewItem_icon |
|
352 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
353 |
|
354 |
|
355 \deprecated P_ItemHighlight_background |
|
356 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
357 |
|
358 |
|
359 \deprecated P_ToolBarExtension_background |
|
360 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
361 |
|
362 |
|
363 \deprecated P_GridViewItem_text |
|
364 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
365 |
|
366 |
|
367 \deprecated P_GridViewItem_icon |
|
368 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
369 |
|
370 |
|
371 \deprecated P_CheckBox_text |
|
372 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
373 |
|
374 |
|
375 \deprecated P_CheckBox_icon |
|
376 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
377 |
|
378 |
|
379 \deprecated P_CheckBox_toucharea |
|
380 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
381 |
|
382 |
|
383 \deprecated P_Fade_background |
|
384 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
385 |
|
386 |
|
387 \deprecated P_TitlePane_background |
|
388 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
389 |
|
390 |
|
391 \deprecated P_TitlePane_text |
|
392 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
393 |
|
394 |
|
395 \deprecated P_TitlePane_icon |
|
396 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
397 |
|
398 |
|
399 \deprecated P_TitleBar_toucharea |
|
400 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
401 |
|
402 |
|
403 \deprecated P_IndicatorGrou\deprecated P_background |
|
404 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
405 |
|
406 |
|
407 \deprecated P_IndicatorGrou\deprecated P_signalicon |
|
408 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
409 |
|
410 |
|
411 \deprecated P_IndicatorGrou\deprecated P_batteryicon |
|
412 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
413 |
|
414 |
|
415 \deprecated P_SignalIndicator_icon |
|
416 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
417 |
|
418 |
|
419 \deprecated P_SignalLevel_background |
|
420 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
421 |
|
422 |
|
423 \deprecated P_SignalLevel_icon |
|
424 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
425 |
|
426 |
|
427 \deprecated P_BatteryIndicator_icon |
|
428 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
429 |
|
430 |
|
431 \deprecated P_BatteryLevel_background |
|
432 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
433 |
|
434 |
|
435 \deprecated P_BatteryLevel_icon |
|
436 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
437 |
|
438 |
|
439 \deprecated P_IndicatorGrou\deprecated P_icon1 |
|
440 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
441 |
|
442 |
|
443 \deprecated P_IndicatorGrou\deprecated P_icon2 |
|
444 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
445 |
|
446 |
|
447 \deprecated P_IndicatorGrou\deprecated P_icon3 |
|
448 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
449 |
|
450 |
|
451 \deprecated P_IndicatorGrou\deprecated P_icon4 |
|
452 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
453 |
|
454 |
|
455 \deprecated P_ProgressBar_frame |
|
456 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
457 |
|
458 |
|
459 \deprecated P_ProgressBar_track |
|
460 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
461 |
|
462 |
|
463 \deprecated P_ProgressBar_waittrack |
|
464 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
465 |
|
466 |
|
467 \deprecated P_ProgressBar_mintext |
|
468 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
469 |
|
470 |
|
471 \deprecated P_ProgressBar_maxtext |
|
472 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
473 |
|
474 |
|
475 \deprecated P_Softkey_background |
|
476 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
477 |
|
478 |
|
479 \deprecated P_NavigationButton_background |
|
480 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
481 |
|
482 |
|
483 \deprecated P_IndicatorButton_background |
|
484 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
485 |
|
486 |
|
487 \deprecated P_IndicatorButton_handleindication |
|
488 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
489 |
|
490 |
|
491 \deprecated P_ItemViewItem_frame |
|
492 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
493 |
|
494 |
|
495 \deprecated P_SelectionControl_selectionstart |
|
496 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
497 |
|
498 |
|
499 \deprecated P_SelectionControl_selectionend |
|
500 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
501 |
|
502 |
|
503 \deprecated P_TreeViewItem_expandicon |
|
504 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
505 |
|
506 |
|
507 \deprecated P_Label_richtext |
|
508 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
509 |
|
510 |
|
511 \deprecated P_RatingSlider_track |
|
512 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
513 |
|
514 |
|
515 \deprecated P_RatingSlider_frame |
|
516 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
517 |
|
518 |
|
519 \deprecated P_RatingSlider_toucharea |
|
520 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
521 |
|
522 |
|
523 \deprecated P_ProgressSlider_frame |
|
524 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
525 |
|
526 |
|
527 \deprecated P_ProgressSlider_track |
|
528 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
529 |
|
530 |
|
531 \deprecated P_ProgressSlider_slidertrack |
|
532 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
533 |
|
534 |
|
535 \deprecated P_ProgressSlider_toucharea |
|
536 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
537 |
|
538 |
|
539 \deprecated P_ProgressSliderHandle_background |
|
540 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
541 |
|
542 |
|
543 \deprecated P_ProgressSliderHandle_icon |
|
544 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
545 |
|
546 |
|
547 \deprecated P_ProgressSliderHandle_toucharea |
|
548 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
549 |
|
550 |
|
551 \deprecated P_RatingSlider_layout |
|
552 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
553 |
|
554 |
|
555 \deprecated P_ScrollArea_continuationbottom |
|
556 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
557 |
|
558 |
|
559 \deprecated P_ScrollArea_continuationtop |
|
560 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
561 |
|
562 |
|
563 \deprecated P_ScrollArea_continuationleft |
|
564 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
565 |
|
566 |
|
567 \deprecated P_ScrollArea_continuationright |
|
568 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
569 |
|
570 |
|
571 \deprecated P_ItemViewItem_focus |
|
572 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
573 |
|
574 |
|
575 \deprecated P_NotificationDialog_icon |
|
576 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
577 |
|
578 |
|
579 \deprecated P_NotificationDialog_text |
|
580 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
581 |
|
582 |
|
583 \deprecated P_NotificationDialog_title |
|
584 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
585 |
|
586 |
|
587 \deprecated P_NotificationDialog_frame |
|
588 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
589 |
|
590 |
|
591 \deprecated P_ComboBox_background |
|
592 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
593 |
|
594 |
|
595 \deprecated P_ComboBoxPopu\deprecated P_background |
|
596 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
597 |
|
598 |
|
599 \deprecated P_ComboBoxButton_toucharea |
|
600 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
601 |
|
602 |
|
603 \deprecated P_ComboBox_text |
|
604 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
605 |
|
606 |
|
607 \deprecated P_DataItem_background |
|
608 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
609 |
|
610 |
|
611 \deprecated P_DataItem_separator |
|
612 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
613 |
|
614 |
|
615 \deprecated P_ColorGridViewItem_colorIcon |
|
616 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
617 |
|
618 |
|
619 \deprecated P_ColorGridViewItem_borderIcon |
|
620 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
621 |
|
622 |
|
623 \deprecated P_ColorGridViewItem_checkIcon |
|
624 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
625 |
|
626 |
|
627 \deprecated P_ComboBox_button |
|
628 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
629 |
|
630 |
|
631 \deprecated P_ProgressDialog_icon |
|
632 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
633 |
|
634 |
|
635 \deprecated P_ProgressDialog_text |
|
636 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
637 |
|
638 |
|
639 \deprecated P_DataItem_label |
|
640 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
641 |
|
642 |
|
643 \deprecated P_DataItem_description |
|
644 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
645 |
|
646 |
|
647 \deprecated P_SliderElement_touchincrease |
|
648 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
649 |
|
650 |
|
651 \deprecated P_SliderElement_touchdecrease |
|
652 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
653 |
|
654 |
|
655 \deprecated P_SliderElement_touchhandle |
|
656 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
657 |
|
658 |
|
659 \deprecated P_SliderElement_touchgroove |
|
660 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
661 |
|
662 |
|
663 \deprecated P_SliderTickMark_majoricon |
|
664 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
665 |
|
666 |
|
667 \deprecated P_SliderTickMark_minoricon |
|
668 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
669 |
|
670 |
|
671 \deprecated P_SliderTickMark_majorlabel |
|
672 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
673 |
|
674 |
|
675 \deprecated P_SliderTickMark_minorlabel |
|
676 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
677 |
|
678 |
|
679 \deprecated P_QueryInputMode_image |
|
680 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
681 |
|
682 |
|
683 \deprecated P_GroupBoxHeading_icon |
|
684 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
685 |
|
686 |
|
687 \deprecated P_GroupBoxHeading_text |
|
688 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
689 |
|
690 |
|
691 \deprecated P_GroupBoxMarquee_text |
|
692 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
693 |
|
694 |
|
695 \deprecated P_GroupBoxHeading_background |
|
696 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
697 |
|
698 |
|
699 \deprecated P_GroupBoxContent_background |
|
700 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
701 |
|
702 |
|
703 \deprecated P_DataItem_icon |
|
704 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
705 |
|
706 |
|
707 \deprecated P_ItemViewItem_touchmultiselection |
|
708 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
709 |
|
710 |
|
711 \deprecated P_TumbleView_background |
|
712 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
713 |
|
714 |
|
715 \deprecated P_TumbleView_frame |
|
716 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
717 |
|
718 |
|
719 \deprecated P_TumbleView_highlight |
|
720 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
721 |
|
722 |
|
723 \deprecated P_DateTimePicker_background |
|
724 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
725 |
|
726 |
|
727 \deprecated P_DateTimePicker_frame |
|
728 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
729 |
|
730 |
|
731 \deprecated P_DateTimePicker_separator |
|
732 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
733 |
|
734 |
|
735 \deprecated P_IndexFeedback_popu\deprecated P_text |
|
736 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
737 |
|
738 |
|
739 \deprecated P_IndexFeedback_popu\deprecated P_background |
|
740 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
741 |
|
742 |
|
743 \deprecated P_SliderPopu\deprecated P_background |
|
744 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
745 |
|
746 |
|
747 \deprecated P_StatusBar_background |
|
748 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
749 |
|
750 |
|
751 \deprecated P_StatusBar_timetext |
|
752 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
753 |
|
754 |
|
755 \deprecated P_InputDialog_text |
|
756 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
757 |
|
758 |
|
759 \deprecated P_InputDialog_additionaltext |
|
760 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
761 |
|
762 |
|
763 \deprecated P_ProgressSlider_toucharea |
|
764 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
765 |
|
766 |
|
767 \deprecated P_ProgressSlider_track |
|
768 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
769 |
|
770 |
|
771 \deprecated P_ProgressSliderHandle_icon |
|
772 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
773 |
|
774 |
|
775 \deprecated P_InputDialog_additionaltext |
|
776 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
777 |
|
778 |
|
779 \deprecated P_MessageBox_text |
|
780 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
781 |
|
782 |
|
783 \deprecated P_ProgressSlider_handle |
|
784 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
785 |
|
786 |
|
787 \deprecated P_ProgressBar_text |
|
788 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
|
789 */ |
|
790 |
|
791 // TODO: margins should be defined in layout data once layout specification exists. |
148 // TODO: margins should be defined in layout data once layout specification exists. |
792 static const int ItemName = 0xfffe; |
|
793 static const QString STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w"); |
149 static const QString STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w"); |
794 static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color"); |
150 static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color.css"); |
795 static const int TOUCHAREA_ZVALUE = 1000; |
151 static const int TOUCHAREA_ZVALUE = 1000; |
796 |
152 |
797 static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css"); |
153 static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css"); |
798 |
154 |
799 static const char* LAYOUT_PTR_PROPERTY = "HbStyle_layout_ptr"; |
155 static const char* LAYOUT_PTR_PROPERTY = "HbStyle_layout_ptr"; |
838 */ |
195 */ |
839 HbStyle::~HbStyle() |
196 HbStyle::~HbStyle() |
840 { |
197 { |
841 delete d_ptr; |
198 delete d_ptr; |
842 } |
199 } |
843 |
|
844 |
|
845 /*! |
200 /*! |
846 |
201 Instantiates widget building blocks. The building blocks are called "primitives" and their main function is to perform the painting (e.g. drawing text). |
847 \deprecated HbStyle::createPrimitive(HbStyle::Primitive, QGraphicsItem*) |
202 A set of base primitives are defined in HbStyle::BasePrimitive enumeration. A widget calling this method should not cast the returned QGraphicsObject |
848 is deprecated. This method will be replaced with an altered version which will use new base primitive enumerations. |
203 to the actual primitive object. By following this rule the styling mechanism can be used to change the actual primitive instance to something else than the original one |
849 |
204 instantiated by the createPrimitive() method. This enables customizing the painting of the UI without touching the widget code. |
850 Creates instances of primitive graphics items. This method should be used by all widgets that support styling. |
205 |
851 When changing the style the returned primitives can be replaced with an altered version of the primitives, or with a completely |
206 Updating of a primitive's state is done by using HbStyle::updatePrimitive() method which uses the style primitive data classes (comparable to |
852 different primitive, to create a custom appearance. This shouldn't cause changes to the widget if the functional design |
207 Qt styleoptions) to get the state information needed for the primitive updating. |
853 remains the same. |
208 |
854 |
209 \param primitiveType enumeration of the base primitive |
855 This method returns HbWidgetBase objects. A widget can store the returned items as HbWidgetBase. If a widget |
210 \param itemName string which identifies a primitive in the widget (e.g. "background", or "text"). The item name matches with primitive names in widget's CSS file. |
856 does not require any functionality from HbWidgetBase then it should store the primitives as QGraphicsItems. |
211 \param parent parent for the primitive, although the default is 0 usually the widget is given as a parent for the primitive |
857 |
212 \return QGraphicsObject, the returned primitive should be stored as a QGraphicsObject on the widget side |
858 \note This method is used to replace the conventional Qt-style paint indirection via drawPrimitive. |
213 \sa HbStyle::updatePrimitive() |
859 \sa HbStyle::updatePrimitive method which is to be used in conjunction with this method |
214 \sa HbStylePrimitiveData |
860 \sa HbWidgetBase |
215 \sa HbStyleTextPrimitiveData |
861 \param primitive, to identify the primitive to create |
216 \sa HbStyleFramePrimitiveData |
862 \param parent of the item |
217 \sa HbStyleIconPrimitiveData |
863 \return HbWidgetBase is returned. |
218 \sa HbStyleRichTextPrimitiveData |
|
219 \sa HbStyleMarqueePrimitiveData |
|
220 \sa HbStyleTouchAreaPrimitiveData |
864 |
221 |
865 */ |
222 */ |
866 QGraphicsItem *HbStyle::createPrimitive( HbStyle::Primitive primitive, QGraphicsItem *parent ) const |
223 QGraphicsObject *HbStyle::createPrimitive(HbStyle::PrimitiveType primitiveType, const QString &itemName, QGraphicsObject *parent) const |
867 { |
224 { |
868 |
225 QGraphicsObject *bp; |
|
226 |
|
227 switch (primitiveType) { |
|
228 case PT_TextItem: |
|
229 bp = new HbTextItem(parent); |
|
230 break; |
|
231 case PT_RichTextItem: |
|
232 bp = new HbRichTextItem(parent); |
|
233 break; |
|
234 case PT_FrameItem: |
|
235 bp = new HbFrameItem(parent); |
|
236 break; |
|
237 case PT_IconItem: |
|
238 bp = new HbIconItem(parent); |
|
239 break; |
|
240 case PT_MarqueeItem: |
|
241 bp = new HbMarqueeItem(parent); |
|
242 break; |
|
243 case PT_TouchArea: |
|
244 bp = new HbTouchArea(parent); |
|
245 break; |
|
246 default: |
|
247 bp = 0; |
|
248 } |
|
249 |
|
250 if (bp != 0) { |
|
251 setItemName(bp, itemName); |
|
252 } |
|
253 |
|
254 return bp; |
|
255 } |
|
256 |
|
257 /*! |
|
258 This method is called by Hb widgets whenever there's a widget state change that results to a change in primitive's state. |
|
259 For example if a button's text changes the button widget needs to update the button's text primitive by calling this method. |
|
260 |
|
261 Widgets need to use the HbStylePrimitiveData-derived classes to carry the primitive state information from the widget to the style. |
|
262 These data classes enable the widget to set the primitives' state information without directly using the primitive APIs. |
|
263 |
|
264 Note that the updating of the primitive attributes is optimized so that if just one value from the primitive data set is updated only that one |
|
265 value will be updated to the primitive on the style side. The values on primitive data classes are stored by using HbStyleValue templated class |
|
266 which keeps track of whether a primitive data value was assigned or not. On the style side before calling the primitive API the HbStyleValue's |
|
267 isSet()-method is called first to check if the widget did assign the primitive data value. |
|
268 |
|
269 |
|
270 \param primitive the primitive to be updated |
|
271 \param data primitive data needed for updating the primitive |
|
272 \param parent optionally the parent can be given |
|
273 \return bool, true if correct primitive type was found from the style, false if not. |
|
274 \sa HbStyle::createPrimitive() |
|
275 \sa HbStylePrimitiveData |
|
276 \sa HbStyleTextPrimitiveData |
|
277 \sa HbStyleFramePrimitiveData |
|
278 \sa HbStyleIconPrimitiveData |
|
279 \sa HbStyleRichTextPrimitiveData |
|
280 \sa HbStyleMarqueePrimitiveData |
|
281 \sa HbStyleTouchAreaPrimitiveData |
|
282 */ |
|
283 bool HbStyle::updatePrimitive(QGraphicsObject *primitive, const HbStylePrimitiveData *data, QGraphicsObject *parent) const |
|
284 { |
|
285 Q_UNUSED(parent); |
|
286 bool ret = false; |
|
287 |
|
288 if (HbTextItem *textItem = qgraphicsitem_cast<HbTextItem*>(primitive)) { |
|
289 const HbStyleTextPrimitiveData *td = hbstyleprimitivedata_cast<const HbStyleTextPrimitiveData*>(data); |
|
290 if (td->text.isSet()) |
|
291 textItem->setText(td->text); |
|
292 if (td->textColor.isSet()) |
|
293 textItem->setTextColor(td->textColor); |
|
294 if (td->alignment.isSet()) |
|
295 textItem->setAlignment(td->alignment); |
|
296 if (td->elideMode.isSet()) |
|
297 textItem->setElideMode(td->elideMode); |
|
298 if (td->textWrapping.isSet()) |
|
299 textItem->setTextWrapping(td->textWrapping); |
|
300 if (td->isTextVisible.isSet()) |
|
301 textItem->setTextVisible(td->isTextVisible); |
|
302 if (td->isTextClip.isSet()) |
|
303 textItem->setTextClip(td->isTextClip); |
|
304 if (td->geometry.isSet()) |
|
305 textItem->setGeometry(td->geometry); |
|
306 if (td->fadeLengths.isSet()) |
|
307 textItem->setFadeLengths(td->fadeLengths); |
|
308 if (td->minimumLines.isSet()) |
|
309 textItem->setMinimumLines(td->minimumLines); |
|
310 if (td->maximumLines.isSet()) |
|
311 textItem->setMaximumLines(td->maximumLines); |
|
312 if (td->fontSpec.isSet()) |
|
313 textItem->setFontSpec(td->fontSpec); |
|
314 ret = true; |
|
315 |
|
316 } else if (HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(primitive)) { |
|
317 const HbStyleIconPrimitiveData *id = hbstyleprimitivedata_cast<const HbStyleIconPrimitiveData*>(data); |
|
318 if (id->icon.isSet()) |
|
319 iconItem->setIcon(id->icon); |
|
320 if (id->size.isSet()) |
|
321 iconItem->setSize(id->size); |
|
322 if (id->aspectRatioMode.isSet()) |
|
323 iconItem->setAspectRatioMode(id->aspectRatioMode); |
|
324 if (id->alignment.isSet()) |
|
325 iconItem->setAlignment(id->alignment); |
|
326 if (id->iconMode.isSet()) |
|
327 iconItem->setMode(id->iconMode); |
|
328 if (id->iconState.isSet()) |
|
329 iconItem->setState(id->iconState); |
|
330 if (id->iconName.isSet()) |
|
331 iconItem->setIconName(id->iconName); |
|
332 if (id->iconFlags.isSet()) |
|
333 iconItem->setFlags(id->iconFlags); |
|
334 if (id->mirroringMode.isSet()) |
|
335 iconItem->setMirroringMode(id->mirroringMode); |
|
336 if (id->brush.isSet()) |
|
337 iconItem->setBrush(id->brush); |
|
338 if (id->color.isSet()) |
|
339 iconItem->setColor(id->color); |
|
340 ret = true; |
|
341 |
|
342 } else if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(primitive)) { |
|
343 const HbStyleFramePrimitiveData *fd = hbstyleprimitivedata_cast<const HbStyleFramePrimitiveData*>(data); |
|
344 HbFrameDrawer *drawer = &(frameItem->frameDrawer()); |
|
345 if (fd->frameGraphicsName.isSet()) |
|
346 drawer->setFrameGraphicsName(fd->frameGraphicsName); |
|
347 if (fd->frameType.isSet()) |
|
348 drawer->setFrameType(fd->frameType); |
|
349 if (fd->borderWidthLeft.isSet() || fd->borderWidthRight.isSet() || fd->borderWidthBottom.isSet() || fd->borderWidthTop.isSet()) |
|
350 drawer->setBorderWidths(fd->borderWidthLeft, fd->borderWidthTop, fd->borderWidthRight, fd->borderWidthBottom); |
|
351 if (fd->fillWholeRect.isSet()) |
|
352 drawer->setFillWholeRect(fd->fillWholeRect); |
|
353 if (fd->mirroringMode.isSet()) |
|
354 drawer->setMirroringMode(fd->mirroringMode); |
|
355 if (fd->fileNameSuffixList.isSet()) |
|
356 drawer->setFileNameSuffixList(fd->fileNameSuffixList); |
|
357 if (fd->pixmapMask.isSet()) |
|
358 drawer->setMask(fd->pixmapMask); |
|
359 if (fd->bitmapMask.isSet()) |
|
360 drawer->setMask(fd->bitmapMask); |
|
361 frameItem->setFrameDrawer(drawer); |
|
362 ret = true; |
|
363 |
|
364 } else if (HbMarqueeItem *marqueeItem = qgraphicsitem_cast<HbMarqueeItem*>(primitive)) { |
|
365 const HbStyleMarqueePrimitiveData *md = hbstyleprimitivedata_cast<const HbStyleMarqueePrimitiveData*>(data); |
|
366 if (md->text.isSet()) |
|
367 marqueeItem->setText(md->text); |
|
368 if (md->textColor.isSet()) |
|
369 marqueeItem->setTextColor(md->textColor); |
|
370 if (md->animation.isSet()) { |
|
371 if (md->animation) |
|
372 marqueeItem->startAnimation(); |
|
373 else |
|
374 marqueeItem->stopAnimation(); |
|
375 } |
|
376 if (md->loopCount.isSet()) |
|
377 marqueeItem->setLoopCount(md->loopCount); |
|
378 ret = true; |
|
379 |
|
380 } else if (HbTouchArea *touchArea = qgraphicsitem_cast<HbTouchArea*>(primitive)) { |
|
381 const HbStyleTouchAreaPrimitiveData *td = hbstyleprimitivedata_cast<const HbStyleTouchAreaPrimitiveData*>(data); |
|
382 if (td->size.isSet()) |
|
383 touchArea->setSize(td->size); |
|
384 if (td->geometry.isSet()) |
|
385 touchArea->setGeometry(td->geometry); |
|
386 ret = true; |
|
387 |
|
388 } else if (HbRichTextItem *richTextItem = qgraphicsitem_cast<HbRichTextItem*>(primitive)) { |
|
389 const HbStyleRichTextPrimitiveData *rd = hbstyleprimitivedata_cast<const HbStyleRichTextPrimitiveData*>(data); |
|
390 if (rd->text.isSet()) |
|
391 richTextItem->setText(rd->text); |
|
392 if (rd->defaultColor.isSet()) |
|
393 richTextItem->setTextDefaultColor(rd->defaultColor); |
|
394 if (rd->alignment.isSet()) |
|
395 richTextItem->setAlignment(rd->alignment); |
|
396 if (rd->textWrappingMode.isSet()) |
|
397 richTextItem->setTextWrapping(rd->textWrappingMode); |
|
398 if (rd->isTextVisible.isSet()) |
|
399 richTextItem->setTextVisible(rd->isTextVisible); |
|
400 if (rd->clipping.isSet()) |
|
401 richTextItem->setTextClip(rd->clipping); |
|
402 if (rd->geometry.isSet()) |
|
403 richTextItem->setGeometry(rd->geometry); |
|
404 ret = true; |
|
405 } |
|
406 |
|
407 if (ret) { |
|
408 if (data->geometry.isSet() |
|
409 && primitive->isWidget()) { |
|
410 static_cast<QGraphicsWidget*>(primitive)->setGeometry(data->geometry); |
|
411 } |
|
412 } |
|
413 |
|
414 return ret; |
|
415 } |
|
416 |
|
417 |
|
418 QGraphicsItem *HbStylePrivate::createPrimitive( HbStylePrivate::Primitive primitive, QGraphicsItem *parent ) |
|
419 { |
|
420 |
869 switch (primitive){ |
421 switch (primitive){ |
870 case P_MenuItem_submenuindicator: |
|
871 { |
|
872 HbIconItem *item = new HbIconItem(parent); |
|
873 setItemName(item, QLatin1String("submenu-indicator")); |
|
874 return item; |
|
875 } |
|
876 |
|
877 case P_MenuItem_checkindicator: |
|
878 { |
|
879 HbIconItem *item = new HbIconItem(parent); |
|
880 setItemName(item, QLatin1String("check-indicator")); |
|
881 return item; |
|
882 } |
|
883 |
|
884 case P_MenuItem_separator: |
|
885 { |
|
886 HbIconItem *item = new HbIconItem(parent); |
|
887 setItemName(item, QLatin1String("separator")); |
|
888 return item; |
|
889 } |
|
890 case P_ToolButton_icon: |
422 case P_ToolButton_icon: |
891 case P_PushButton_icon: |
423 case P_PushButton_icon: |
892 case P_ProgressDialog_icon: { |
424 case P_ProgressDialog_icon: { |
893 HbIconItem *iconItem = new HbIconItem(HbIcon(),parent); |
425 HbIconItem *iconItem = new HbIconItem(HbIcon(),parent); |
894 setItemName(iconItem, QLatin1String("icon")); |
426 HbStyle::setItemName(iconItem, QLatin1String("icon")); |
895 return iconItem; |
427 return iconItem; |
896 } |
428 } |
897 |
429 |
898 case P_CheckBox_icon: |
430 case P_CheckBox_icon: |
899 case P_GroupBoxHeading_icon: |
431 case P_GroupBoxHeading_icon: |
900 case P_Label_icon: |
432 case P_Label_icon: { |
|
433 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent)); |
|
434 HbStyle::setItemName(item, QLatin1String("icon")); |
|
435 return item; |
|
436 } |
901 case P_GridViewItem_icon: { |
437 case P_GridViewItem_icon: { |
902 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent)); |
438 Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_icon no more supported. Use refactored styling"); |
903 setItemName(item, QLatin1String("icon")); |
439 return 0; |
904 return item; |
440 } |
905 } |
|
906 case P_DataGroup_icon: |
441 case P_DataGroup_icon: |
907 { |
442 { |
908 HbIconItem *item = new HbIconItem(HbIcon(), parent); |
443 HbIconItem *item = new HbIconItem(HbIcon(), parent); |
909 setItemName(item, QLatin1String("dataGroup_Icon")); |
444 HbStyle::setItemName(item, QLatin1String("dataGroup_Icon")); |
910 return item; |
445 return item; |
911 } |
446 } |
912 case P_DataItem_icon: |
447 case P_DataItem_icon: |
913 { |
448 { |
914 HbIconItem *item = new HbIconItem(HbIcon(), parent); |
449 HbIconItem *item = new HbIconItem(HbIcon(), parent); |
915 setItemName(item, QLatin1String("dataItem_Icon")); |
450 HbStyle::setItemName(item, QLatin1String("dataItem_Icon")); |
916 return item; |
451 return item; |
917 } |
452 } |
918 case P_ComboBox_text: |
453 case P_ComboBox_text: |
919 { |
454 { |
920 HbTextItem *textItem = new HbTextItem(parent); |
455 HbTextItem *textItem = new HbTextItem(parent); |
921 setItemName(textItem, QLatin1String("combobox_labelfield")); |
456 HbStyle::setItemName(textItem, QLatin1String("combobox_labelfield")); |
922 return textItem; |
457 return textItem; |
923 } |
458 } |
924 case P_ToolButton_text: |
459 case P_ToolButton_text: |
925 case P_CheckBox_text: |
460 case P_CheckBox_text: |
926 case P_ProgressDialog_text: |
461 case P_ProgressDialog_text: |
927 { |
462 { |
928 HbTextItem *textItem = new HbTextItem(parent); |
463 HbTextItem *textItem = new HbTextItem(parent); |
929 setItemName(textItem, QLatin1String("text")); |
464 HbStyle::setItemName(textItem, QLatin1String("text")); |
|
465 textItem->setTextWrapping(Hb::TextWordWrap); |
930 return textItem; |
466 return textItem; |
931 } |
467 } |
932 case P_PushButton_text: |
468 case P_PushButton_text: |
933 { |
469 { |
934 HbTextItem *ti = new HbTextItem(parent); |
470 HbTextItem *ti = new HbTextItem(parent); |
935 setItemName(ti, QLatin1String("text")); |
471 HbStyle::setItemName(ti, QLatin1String("text")); |
936 return ti; |
472 return ti; |
937 } |
473 } |
938 case P_DataGroup_heading: |
474 case P_DataGroup_heading: |
939 { |
475 { |
940 HbTextItem *ti = new HbTextItem(parent); |
476 HbTextItem *ti = new HbTextItem(parent); |
941 setItemName(ti, QLatin1String("dataGroup_HeadingLabel")); |
477 HbStyle::setItemName(ti, QLatin1String("dataGroup_HeadingLabel")); |
942 return ti; |
478 return ti; |
943 } |
479 } |
944 case P_DataGroup_description: |
480 case P_DataGroup_description: |
945 { |
481 { |
946 HbTextItem *ti = new HbTextItem(parent); |
482 HbTextItem *ti = new HbTextItem(parent); |
947 setItemName(ti, QLatin1String("dataGroup_Description")); |
483 HbStyle::setItemName(ti, QLatin1String("dataGroup_Description")); |
948 return ti; |
484 return ti; |
949 } |
485 } |
950 case P_DataForm_heading: |
486 case P_DataForm_heading: |
951 { |
487 { |
952 HbTextItem *ti = new HbTextItem(parent); |
488 HbTextItem *ti = new HbTextItem(parent); |
953 setItemName(ti, QLatin1String("dataForm_Heading")); |
489 HbStyle::setItemName(ti, QLatin1String("dataForm_Heading")); |
954 //ti->setZValue(2); |
490 //ti->setZValue(2); |
955 return ti; |
491 return ti; |
956 } |
492 } |
957 case P_DataForm_description: |
493 case P_DataForm_description: |
958 { |
494 { |
959 HbTextItem *ti = new HbTextItem(parent); |
495 HbTextItem *ti = new HbTextItem(parent); |
960 setItemName(ti, QLatin1String("dataForm_Desc")); |
496 HbStyle::setItemName(ti, QLatin1String("dataForm_Desc")); |
961 return ti; |
497 return ti; |
962 } |
498 } |
963 case P_PushButton_additionaltext: |
499 case P_PushButton_additionaltext: |
964 { |
500 { |
965 HbTextItem *ti = new HbTextItem(parent); |
501 HbTextItem *ti = new HbTextItem(parent); |
966 setItemName(ti, QLatin1String("additional-text")); |
502 HbStyle::setItemName(ti, QLatin1String("additional-text")); |
967 return ti; |
503 return ti; |
968 } |
504 } |
|
505 |
969 case P_ProgressSlider_toucharea: |
506 case P_ProgressSlider_toucharea: |
970 { |
507 return 0; |
971 HbTouchArea *ta = new HbTouchArea(parent); |
|
972 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
|
973 setItemName(ta, QLatin1String("toucharea")); |
|
974 ta->setZValue(TOUCHAREA_ZVALUE); |
|
975 return ta; |
|
976 } |
|
977 case P_ProgressSliderHandle_toucharea: |
508 case P_ProgressSliderHandle_toucharea: |
978 { |
509 return 0; |
979 HbTouchArea *ta = new HbTouchArea(parent); |
|
980 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
|
981 setItemName(ta, QLatin1String("toucharea")); |
|
982 ta->setZValue(TOUCHAREA_ZVALUE); |
|
983 if(parent){ |
|
984 parent->setFiltersChildEvents(true); |
|
985 } |
|
986 return ta; |
|
987 } |
|
988 |
510 |
989 case P_ProgressSliderHandle_icon: |
511 case P_ProgressSliderHandle_icon: |
990 { |
512 { |
991 HbIconItem *item = new HbIconItem(QLatin1String("qtg_graf_progslider_handle_normal"), parent); |
513 HbIconItem *item = new HbIconItem(QLatin1String("qtg_graf_progslider_handle_normal"), parent); |
992 item->setAspectRatioMode(Qt::IgnoreAspectRatio); |
514 item->setAspectRatioMode(Qt::IgnoreAspectRatio); |
1168 } |
668 } |
1169 case P_DataGroup_background : |
669 case P_DataGroup_background : |
1170 { |
670 { |
1171 HbFrameItem *n = new HbFrameItem(parent); |
671 HbFrameItem *n = new HbFrameItem(parent); |
1172 n->setZValue(-1); |
672 n->setZValue(-1); |
1173 setItemName(n, QLatin1String("dataGroup_Background")); |
673 HbStyle::setItemName(n, QLatin1String("dataGroup_Background")); |
1174 return n; |
674 return n; |
1175 } |
675 } |
1176 case P_DataGroupComboBackground: |
676 case P_DataGroupComboBackground: |
1177 { |
677 { |
1178 HbFrameItem *n = new HbFrameItem(parent); |
678 HbFrameItem *n = new HbFrameItem(parent); |
1179 n->setZValue(-1); |
679 n->setZValue(-1); |
1180 setItemName(n, QLatin1String("dataGroup_ComboBackground")); |
680 HbStyle::setItemName(n, QLatin1String("dataGroup_ComboBackground")); |
1181 return n; |
681 return n; |
1182 } |
682 } |
1183 case P_DataForm_heading_background : |
683 case P_DataForm_heading_background : |
1184 { |
684 { |
1185 HbFrameItem *n = new HbFrameItem(parent); |
685 HbFrameItem *n = new HbFrameItem(parent); |
1186 n->setZValue(-1); |
686 n->setZValue(-1); |
1187 setItemName(n, QLatin1String("dataFormHeading_Background")); |
687 HbStyle::setItemName(n, QLatin1String("dataFormHeading_Background")); |
1188 return n; |
688 return n; |
1189 } |
689 } |
1190 case P_DataItem_background: |
690 case P_DataItem_background: |
1191 { |
691 { |
1192 HbFrameItem *n = new HbFrameItem(parent); |
692 HbFrameItem *n = new HbFrameItem(parent); |
1193 n->setZValue(-2); |
693 n->setZValue(-2); |
1194 setItemName(n, QLatin1String("dataItem_Background")); |
694 HbStyle::setItemName(n, QLatin1String("dataItem_Background")); |
1195 return n; |
695 return n; |
1196 } |
696 } |
1197 case P_GroupBoxContent_background: |
697 case P_GroupBoxContent_background: |
1198 case P_GroupBoxHeading_background: |
698 case P_GroupBoxHeading_background: |
1199 case P_PushButton_background: |
699 case P_PushButton_background: |
1200 { |
700 { |
1201 HbFrameItem *n = new HbFrameItem(parent); |
701 HbFrameItem *n = new HbFrameItem(parent); |
1202 n->setZValue(-1); |
702 n->setZValue(-1); |
1203 setItemName(n, QLatin1String("background")); |
703 HbStyle::setItemName(n, QLatin1String("background")); |
1204 return n; |
704 return n; |
1205 } |
705 } |
|
706 |
1206 case P_ProgressBar_track: |
707 case P_ProgressBar_track: |
1207 { |
708 return 0; |
1208 HbProgressTrackItem *n = new HbProgressTrackItem(parent); |
|
1209 n->frameDrawer().setFillWholeRect(true); |
|
1210 n->setZValue(-2); |
|
1211 return n; |
|
1212 } |
|
1213 case P_ProgressSlider_slidertrack: |
709 case P_ProgressSlider_slidertrack: |
1214 { |
710 return 0; |
1215 HbProgressTrackItem *n = new HbProgressTrackItem(parent); |
711 |
1216 n->setZValue(-1); |
|
1217 return n; |
|
1218 } |
|
1219 case P_Slider_progressgroove: |
712 case P_Slider_progressgroove: |
1220 { |
713 { |
1221 HbSliderTrackItem *n=new HbSliderTrackItem(parent); |
714 HbSliderTrackItem *n=new HbSliderTrackItem(parent); |
1222 n->setZValue(0); |
715 n->setZValue(0); |
1223 return n; |
716 return n; |
1224 } |
717 } |
1225 case P_ToolButton_frame: |
718 case P_ToolButton_frame: |
1226 { |
719 { |
1227 HbFrameItem *n = new HbFrameItem(parent); |
720 HbFrameItem *n = new HbFrameItem(parent); |
1228 n->setZValue(-1); |
721 n->setZValue(-1); |
1229 setItemName(n, QLatin1String("background")); |
722 HbStyle::setItemName(n, QLatin1String("background")); |
1230 return n; |
723 return n; |
1231 } |
724 } |
1232 case P_NavigationButton_background: |
725 case P_NavigationButton_background: |
1233 case P_IndicatorButton_background: |
726 case P_IndicatorButton_background: |
1234 { |
727 { |
1235 HbIconItem *n = new HbIconItem(HbIcon(), parent); |
728 HbIconItem *n = new HbIconItem(HbIcon(), parent); |
1236 n->setZValue(-1); |
729 n->setZValue(-1); |
1237 setItemName(n, QLatin1String("background")); |
730 HbStyle::setItemName(n, QLatin1String("background")); |
1238 return n; |
731 return n; |
1239 } |
732 } |
1240 case P_IndicatorButton_handleindication: |
733 case P_IndicatorButton_handleindication: |
1241 { |
734 { |
1242 HbIconItem *n = new HbIconItem(parent); |
735 HbIconItem *n = new HbIconItem(parent); |
1243 setItemName(n, QLatin1String("handleindication")); |
736 HbStyle::setItemName(n, QLatin1String("handleindication")); |
1244 return n; |
737 return n; |
1245 } |
738 } |
1246 case P_IndicatorButton_eventindication: |
739 case P_IndicatorButton_eventindication: |
1247 { |
740 { |
1248 HbIconItem *n = new HbIconItem(parent); |
741 HbIconItem *n = new HbIconItem(parent); |
1249 n->setFlags(HbIcon::Colorized); |
742 n->setFlags(HbIcon::Colorized); |
1250 setItemName(n, QLatin1String("eventindication")); |
743 HbStyle::setItemName(n, QLatin1String("eventindication")); |
1251 return n; |
744 return n; |
1252 } |
745 } |
1253 case P_IndicatorGroup_icon1: |
746 case P_IndicatorGroup_icon1: |
1254 { |
747 { |
1255 HbIconItem *n = new HbIconItem(parent); |
748 HbIconItem *n = new HbIconItem(parent); |
1256 n->setFlags(HbIcon::Colorized); |
749 n->setFlags(HbIcon::Colorized); |
1257 setItemName(n, QLatin1String("icon1")); |
750 HbStyle::setItemName(n, QLatin1String("icon1")); |
1258 return n; |
751 return n; |
1259 } |
752 } |
1260 case P_IndicatorGroup_icon2: |
753 case P_IndicatorGroup_icon2: |
1261 { |
754 { |
1262 HbIconItem *n = new HbIconItem(parent); |
755 HbIconItem *n = new HbIconItem(parent); |
1263 n->setFlags(HbIcon::Colorized); |
756 n->setFlags(HbIcon::Colorized); |
1264 setItemName(n, QLatin1String("icon2")); |
757 HbStyle::setItemName(n, QLatin1String("icon2")); |
1265 return n; |
758 return n; |
1266 } |
759 } |
1267 case P_IndicatorGroup_icon3: |
760 case P_IndicatorGroup_icon3: |
1268 { |
761 { |
1269 HbIconItem *n = new HbIconItem(parent); |
762 HbIconItem *n = new HbIconItem(parent); |
1270 n->setFlags(HbIcon::Colorized); |
763 n->setFlags(HbIcon::Colorized); |
1271 setItemName(n, QLatin1String("icon3")); |
764 HbStyle::setItemName(n, QLatin1String("icon3")); |
1272 return n; |
765 return n; |
1273 } |
766 } |
1274 case P_IndicatorGroup_icon4: |
767 case P_IndicatorGroup_icon4: |
1275 { |
768 { |
1276 HbIconItem *n = new HbIconItem(parent); |
769 HbIconItem *n = new HbIconItem(parent); |
1277 n->setFlags(HbIcon::Colorized); |
770 n->setFlags(HbIcon::Colorized); |
1278 setItemName(n, QLatin1String("icon4")); |
771 HbStyle::setItemName(n, QLatin1String("icon4")); |
1279 return n; |
772 return n; |
1280 } |
773 } |
1281 case P_SignalIndicator_icon: |
774 case P_SignalIndicator_icon: |
1282 { |
775 { |
1283 HbIconItem *n = new HbIconItem(parent); |
776 HbIconItem *n = new HbIconItem(parent); |
1284 n->setFlags(HbIcon::Colorized); |
777 n->setFlags(HbIcon::Colorized); |
1285 setItemName(n, QLatin1String("icon")); |
778 HbStyle::setItemName(n, QLatin1String("icon")); |
1286 return n; |
779 return n; |
1287 } |
780 } |
1288 case P_SignalLevel_background: |
781 case P_SignalLevel_background: |
1289 { |
782 { |
1290 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
783 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
1291 n->setZValue(-1); |
784 n->setZValue(-1); |
1292 setItemName(n, QLatin1String("background")); |
785 HbStyle::setItemName(n, QLatin1String("background")); |
1293 return n; |
786 return n; |
1294 } |
787 } |
1295 case P_SignalLevel_icon: |
788 case P_SignalLevel_icon: |
1296 { |
789 { |
1297 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
790 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
1298 setItemName(n, QLatin1String("levelicon")); |
791 HbStyle::setItemName(n, QLatin1String("levelicon")); |
1299 return n; |
792 return n; |
1300 } |
793 } |
1301 case P_BatteryIndicator_icon: |
794 case P_BatteryIndicator_icon: |
1302 { |
795 { |
1303 HbIconItem *n = new HbIconItem(parent); |
796 HbIconItem *n = new HbIconItem(parent); |
1304 n->setFlags(HbIcon::Colorized); |
797 n->setFlags(HbIcon::Colorized); |
1305 setItemName(n, QLatin1String("icon")); |
798 HbStyle::setItemName(n, QLatin1String("icon")); |
1306 return n; |
799 return n; |
1307 } |
800 } |
1308 case P_BatteryLevel_background: |
801 case P_BatteryLevel_background: |
1309 { |
802 { |
1310 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
803 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
1311 n->setZValue(-1); |
804 n->setZValue(-1); |
1312 setItemName(n, QLatin1String("background")); |
805 HbStyle::setItemName(n, QLatin1String("background")); |
1313 return n; |
806 return n; |
1314 } |
807 } |
1315 case P_BatteryLevel_icon: |
808 case P_BatteryLevel_icon: |
1316 { |
809 { |
1317 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
810 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
1318 setItemName(n, QLatin1String("levelicon")); |
811 HbStyle::setItemName(n, QLatin1String("levelicon")); |
1319 return n; |
812 return n; |
1320 } |
813 } |
1321 case P_TitlePane_background: |
814 case P_TitlePane_background: |
1322 { |
815 { |
1323 HbFrameItem *n = new HbFrameItem(parent); |
816 HbFrameItem *n = new HbFrameItem(parent); |
1324 n->setZValue(-1); |
817 n->setZValue(-1); |
1325 setItemName(n, QLatin1String("background")); |
818 HbStyle::setItemName(n, QLatin1String("background")); |
1326 return n; |
819 return n; |
1327 } |
820 } |
1328 case P_LineEdit_frame_normal: |
821 case P_LineEdit_frame_normal: |
1329 case P_LineEdit_frame_highlight: |
822 case P_LineEdit_frame_highlight: |
1330 case P_TextEdit_frame_normal: |
823 case P_TextEdit_frame_normal: |
1369 case P_SliderElement_decrease: |
862 case P_SliderElement_decrease: |
1370 return new HbIconItem(QString(), parent); |
863 return new HbIconItem(QString(), parent); |
1371 |
864 |
1372 case P_SliderTickMark_majoricon: { |
865 case P_SliderTickMark_majoricon: { |
1373 HbIconItem *iconItem = new HbIconItem(parent); |
866 HbIconItem *iconItem = new HbIconItem(parent); |
1374 setItemName(iconItem,QLatin1String("tickmark-majoricon")); |
867 HbStyle::setItemName(iconItem,QLatin1String("tickmark-majoricon")); |
1375 return iconItem; |
868 return iconItem; |
1376 } |
869 } |
1377 case P_SliderTickMark_minoricon: { |
870 case P_SliderTickMark_minoricon: { |
1378 HbIconItem *iconItem = new HbIconItem(parent); |
871 HbIconItem *iconItem = new HbIconItem(parent); |
1379 setItemName(iconItem,QLatin1String("tickmark-minoricon")); |
872 HbStyle::setItemName(iconItem,QLatin1String("tickmark-minoricon")); |
1380 return iconItem; |
873 return iconItem; |
1381 } |
874 } |
1382 case P_SliderTickMark_majorlabel: { |
875 case P_SliderTickMark_majorlabel: { |
1383 HbTextItem *textItem = new HbTextItem(parent); |
876 HbTextItem *textItem = new HbTextItem(parent); |
1384 setItemName(textItem,QLatin1String("tickmark-majorlabel")); |
877 HbStyle::setItemName(textItem,QLatin1String("tickmark-majorlabel")); |
1385 return textItem; |
878 return textItem; |
1386 } |
879 } |
1387 case P_SliderTickMark_minorlabel: { |
880 case P_SliderTickMark_minorlabel: { |
1388 HbTextItem *textItem = new HbTextItem(parent); |
881 HbTextItem *textItem = new HbTextItem(parent); |
1389 setItemName(textItem,QLatin1String("tickmark-minorlabel")); |
882 HbStyle::setItemName(textItem,QLatin1String("tickmark-minorlabel")); |
1390 return textItem; |
883 return textItem; |
1391 } |
884 } |
1392 |
885 |
1393 case P_ProgressBar_waittrack: |
886 case P_ProgressBar_waittrack: |
1394 return new HbRepeatIconItem(QLatin1String("qtg_graf_progbar_h_wait"), parent); |
887 return 0; |
1395 |
|
1396 case P_RatingSlider_frame: |
888 case P_RatingSlider_frame: |
1397 return new HbRepeatItem(parent); |
889 return 0; |
1398 |
|
1399 case P_RatingSlider_track: |
890 case P_RatingSlider_track: |
1400 return new HbRepeatMaskItem(parent); |
891 return 0; |
1401 |
892 case P_RatingSlider_layout: |
1402 case P_RatingSlider_layout: { |
893 return 0; |
1403 HbWidgetBase *layout = new HbWidgetBase(parent); |
|
1404 setItemName(layout, "frame"); |
|
1405 return layout; |
|
1406 } |
|
1407 |
894 |
1408 case P_ItemViewItem_checkbox: { |
895 case P_ItemViewItem_checkbox: { |
1409 qDebug() << "Primitive P_ItemViewItem_checkbox is deprecated and will cease to exist in the near future."; |
896 qDebug() << "Primitive P_ItemViewItem_checkbox is deprecated and will cease to exist in the near future."; |
1410 HbIconItem *iconItem = new HbIconItem(parent); |
897 HbIconItem *iconItem = new HbIconItem(parent); |
1411 setItemName(iconItem, QLatin1String("checkbox-icon")); |
898 HbStyle::setItemName(iconItem, QLatin1String("checkbox-icon")); |
1412 return iconItem; |
899 return iconItem; |
1413 } |
900 } |
1414 |
901 |
1415 case P_ItemViewItem_radiobutton: |
902 case P_ItemViewItem_radiobutton: |
1416 case P_ItemViewItem_selection: { |
903 case P_ItemViewItem_selection: { |
1417 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent)); |
904 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_selection no more supported. Use refactored styling"); |
1418 setItemName(iconItem, QLatin1String("selection-icon")); |
905 return 0; |
1419 return iconItem; |
|
1420 } |
906 } |
1421 |
907 |
1422 case P_Edit_text:{ |
908 case P_Edit_text:{ |
1423 return 0; |
909 return 0; |
1424 } |
910 } |
1425 case P_GroupBoxHeading_text: |
911 case P_GroupBoxHeading_text: |
1426 case P_NotificationDialog_text:{ |
912 case P_NotificationDialog_text:{ |
1427 HbTextItem *n = new HbTextItem(parent); |
913 HbTextItem *n = new HbTextItem(parent); |
1428 setItemName(n, QLatin1String("text")); |
914 HbStyle::setItemName(n, QLatin1String("text")); |
1429 n->setMinimumLines(1); |
915 n->setMinimumLines(1); |
1430 n->setMaximumLines(1); |
916 n->setMaximumLines(1); |
1431 n->setTextWrapping(Hb::TextNoWrap); |
917 n->setTextWrapping(Hb::TextNoWrap); |
1432 return n; |
918 return n; |
1433 } |
919 } |
1434 case P_NotificationDialog_title:{ |
920 case P_NotificationDialog_title:{ |
1435 HbTextItem *n = new HbTextItem(parent); |
921 HbTextItem *n = new HbTextItem(parent); |
1436 setItemName(n, QLatin1String("title")); |
922 HbStyle::setItemName(n, QLatin1String("title")); |
1437 return n; |
923 return n; |
1438 } |
924 } |
1439 case P_NotificationDialog_icon:{ |
925 case P_NotificationDialog_icon:{ |
1440 HbIconItem *n = new HbIconItem(QString(), parent); |
926 HbIconItem *n = new HbIconItem(QString(), parent); |
1441 setItemName(n, QLatin1String("icon")); |
927 HbStyle::setItemName(n, QLatin1String("icon")); |
1442 return n; |
928 return n; |
1443 } |
929 } |
1444 case P_MessageBox_text:{ //deprecated |
930 case P_MessageBox_text:{ |
1445 HbTextItem *rti = new HbTextItem(parent); |
931 HbTextItem *rti = new HbTextItem(parent); |
1446 return rti; |
932 return rti; |
1447 } |
933 } |
1448 case P_MessageBox_icon:{ |
934 case P_MessageBox_icon:{ |
1449 HbIconItem *n = new HbIconItem(QString(), parent); |
935 HbIconItem *n = new HbIconItem(QString(), parent); |
1450 return n; |
936 return n; |
1451 } |
937 } |
1452 |
938 |
1453 case P_ItemViewItem_background: { |
939 case P_ItemViewItem_background: { |
1454 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent)); |
940 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_background no more supported. Use refactored styling"); |
1455 iconItem->setZValue(-3.0); |
941 return 0; |
1456 setItemName(iconItem, QLatin1String("background")); |
|
1457 return iconItem; |
|
1458 } |
942 } |
1459 |
943 |
1460 case P_ListViewItem_text: { |
944 case P_ListViewItem_text: { |
1461 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent)); |
945 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_text no more supported. Use refactored styling"); |
1462 |
946 return 0; |
1463 return textItem; |
|
1464 } |
947 } |
1465 |
948 |
1466 case P_ListViewItem_richtext: { |
949 case P_ListViewItem_richtext: { |
1467 HbRichTextItem *textItem = q_check_ptr(new HbRichTextItem(parent)); |
950 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_richtext no more supported. Use refactored styling"); |
1468 return textItem; |
951 return 0; |
1469 } |
952 } |
1470 |
953 |
1471 case P_GridViewItem_text: { |
954 case P_GridViewItem_text: { |
1472 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent)); |
955 Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_text no more supported. Use refactored styling"); |
1473 // caching do not work properly - text is not refreshed immediatelly |
956 return 0; |
1474 //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); |
|
1475 setItemName(textItem, QLatin1String("text")); |
|
1476 return textItem; |
|
1477 } |
957 } |
1478 |
958 |
1479 case P_ListViewItem_icon: |
959 case P_ListViewItem_icon: |
1480 return q_check_ptr(new HbIconItem(parent)); |
960 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_icon no more supported. Use refactored styling"); |
1481 |
961 return 0; |
1482 case P_ColorGridViewItem_colorIcon: |
|
1483 return new HbIconItem("qtg_graf_colorpicker_mask", parent); |
|
1484 case P_ColorGridViewItem_borderIcon: |
|
1485 return new HbIconItem("qtg_graf_colorpicker_filled", parent); |
|
1486 case P_ColorGridViewItem_checkIcon: |
|
1487 return new HbIconItem("qtg_small_tick", parent); |
|
1488 |
962 |
1489 case P_TreeViewItem_expandicon: { |
963 case P_TreeViewItem_expandicon: { |
1490 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent)); |
964 Q_ASSERT_X(false, "HbStyle" , "P_TreeViewItem_expandicon no more supported. Use refactored styling"); |
1491 setItemName(iconItem, QLatin1String("subitem-indicator")); |
965 return 0; |
1492 return iconItem; |
966 } |
1493 } |
967 |
1494 |
|
1495 case P_SelectionControl_selectionstart://fallthrough |
|
1496 case P_SelectionControl_selectionend://fallthrough |
|
1497 { |
|
1498 HbIconItem *iconItem = new HbIconItem(parent); |
|
1499 switch (primitive) { |
|
1500 case P_SelectionControl_selectionstart: |
|
1501 iconItem->setIconName(QLatin1String("qtg_graf_editor_handle_begin")); |
|
1502 break; |
|
1503 case P_SelectionControl_selectionend: |
|
1504 iconItem->setIconName(QLatin1String("qtg_graf_editor_handle_end")); |
|
1505 break; |
|
1506 default: |
|
1507 qWarning("Unknown HbSelectionControl primitive %i", primitive); |
|
1508 break; |
|
1509 } |
|
1510 setItemName(iconItem, QLatin1String("handle-icon")); |
|
1511 return iconItem; |
|
1512 } |
|
1513 case P_ComboBox_button: { |
968 case P_ComboBox_button: { |
1514 HbIconItem *n = new HbIconItem(QString(), parent); |
969 HbIconItem *n = new HbIconItem(QString(), parent); |
1515 return n; |
970 return n; |
1516 } |
971 } |
1517 case P_ItemViewItem_focus: { |
972 case P_ItemViewItem_focus: { |
1518 HbFrameItem *frameItem = q_check_ptr(new HbFrameItem(parent)); |
973 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_focus no more supported. Use refactored styling"); |
1519 frameItem->setZValue(-1.0); |
974 return 0; |
1520 return frameItem; |
|
1521 } |
975 } |
1522 case P_ItemHighlight_background: |
976 case P_ItemHighlight_background: |
1523 return new HbFrameItem(parent); |
977 return new HbFrameItem(parent); |
1524 |
978 |
1525 case P_ItemViewItem_frame: { |
979 case P_ItemViewItem_frame: { |
1526 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent)); |
980 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_frame no more supported. Use refactored styling"); |
1527 item->setZValue(-4.0); |
981 return 0; |
1528 setItemName(item,"frame"); |
982 } |
1529 return item; |
983 case P_ItemViewItem_touchmultiselection: |
1530 } |
984 { |
1531 case P_ScrollArea_continuationbottom: |
985 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_touchmultiselection no more supported. Use refactored styling"); |
1532 { |
986 return 0; |
1533 HbFrameItem *n = new HbFrameItem(parent); |
987 } |
1534 setItemName(n, QLatin1String("continuation-indicator-bottom")); |
988 case P_IndexFeedback_popup_text: |
1535 n->setZValue(-1); |
989 { |
|
990 Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_text no more supported. Use refactored styling"); |
|
991 return 0; |
|
992 } |
|
993 case P_IndexFeedback_popup_background: |
|
994 { |
|
995 Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_background no more supported. Use refactored styling"); |
|
996 return 0; |
|
997 } |
|
998 case P_InputDialog_text: |
|
999 { |
|
1000 HbTextItem *n = new HbTextItem(parent); |
|
1001 n->setTextWrapping(Hb::TextWordWrap); |
|
1002 HbStyle::setItemName(n, QLatin1String("label-1")); |
1536 return n; |
1003 return n; |
1537 } |
1004 } |
1538 case P_ScrollArea_continuationtop: |
1005 case P_InputDialog_additionaltext: |
1539 { |
|
1540 HbFrameItem *n = new HbFrameItem(parent); |
|
1541 setItemName(n, QLatin1String("continuation-indicator-top")); |
|
1542 n->setZValue(-1); |
|
1543 return n; |
|
1544 } |
|
1545 case P_ScrollArea_continuationleft: |
|
1546 { |
|
1547 HbFrameItem *n = new HbFrameItem(parent); |
|
1548 setItemName(n, QLatin1String("continuation-indicator-left")); |
|
1549 n->setZValue(-1); |
|
1550 return n; |
|
1551 } |
|
1552 case P_ScrollArea_continuationright: |
|
1553 { |
|
1554 HbFrameItem *n = new HbFrameItem(parent); |
|
1555 setItemName(n, QLatin1String("continuation-indicator-right")); |
|
1556 n->setZValue(-1); |
|
1557 return n; |
|
1558 } |
|
1559 case P_ItemViewItem_touchmultiselection: |
|
1560 { |
|
1561 HbTouchArea *area = q_check_ptr(new HbTouchArea(parent)); |
|
1562 setItemName(area, "multiselection-toucharea"); |
|
1563 return area; |
|
1564 } |
|
1565 case P_IndexFeedback_popup_text: |
|
1566 { |
|
1567 HbTextItem *textItem = new HbTextItem(parent); |
|
1568 textItem->setAlignment(Qt::AlignCenter); |
|
1569 textItem->setTextWrapping(Hb::TextNoWrap); |
|
1570 setItemName(textItem, QLatin1String("index-text")); |
|
1571 |
|
1572 //TODO:: make this a sane value |
|
1573 textItem->setZValue(4); |
|
1574 return textItem; |
|
1575 } |
|
1576 case P_IndexFeedback_popup_background: |
|
1577 { |
|
1578 HbFrameItem *n = new HbFrameItem(parent); |
|
1579 n->frameDrawer().setFrameGraphicsName("qtg_fr_popup_preview"); |
|
1580 n->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
1581 qreal cornerPieceSize = 0; |
|
1582 parameter(QLatin1String("hb-param-background-popup-preview"),cornerPieceSize); |
|
1583 n->frameDrawer().setBorderWidths(cornerPieceSize, cornerPieceSize); |
|
1584 setItemName(n, QLatin1String("index-background")); |
|
1585 n->setZValue(3); |
|
1586 return n; |
|
1587 } |
|
1588 case P_InputDialog_text: |
|
1589 { |
1006 { |
1590 HbTextItem *n = new HbTextItem(parent); |
1007 HbTextItem *n = new HbTextItem(parent); |
1591 setItemName(n, QLatin1String("label-1")); |
1008 n->setTextWrapping(Hb::TextWordWrap); |
1592 return n; |
1009 HbStyle::setItemName(n, QLatin1String("label-2")); |
1593 } |
|
1594 case P_InputDialog_additionaltext: |
|
1595 { |
|
1596 HbTextItem *n = new HbTextItem(parent); |
|
1597 setItemName(n, QLatin1String("label-2")); |
|
1598 return n; |
1010 return n; |
1599 } |
1011 } |
1600 default: |
1012 default: |
1601 return 0; |
1013 return 0; |
1602 } |
1014 } |
1603 } |
1015 } |
1604 |
1016 |
1605 /*! |
1017 void HbStylePrivate::updatePrimitive( QGraphicsItem *item, HbStylePrivate::Primitive primitive, const QStyleOption *option ) |
1606 |
|
1607 \deprecated HbStyle::updatePrimitive(QGraphicsItem*, HbStyle::Primitive, const QStyleOption*) |
|
1608 is deprecated. This method will be made private and finally removed since primitive updating will be done in the widgets. |
|
1609 |
|
1610 Updates the state and content of widget's child primitives. Update for a styled primitive should happen always when |
|
1611 a state change that affects drawing occurs. Such a situation can be for example pressing of a button (change background image), or |
|
1612 changing a text for a widget having text content. The updatePrimitive() implementation for each primitive element can be considered |
|
1613 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 |
|
1614 uses the styleoption data for. |
|
1615 |
|
1616 \sa HbStyle::createPrimitive |
|
1617 \param item Primitive graphicsitem. |
|
1618 \param primitive To identify the primitive to create. |
|
1619 \param option Style option, contains all the information needed to update the primitive, this |
|
1620 information is widget specific and each widget usually has a styleoption. Styleoption may include |
|
1621 information about the widget's state, content etc. |
|
1622 */ |
|
1623 void HbStyle::updatePrimitive( QGraphicsItem *item, HbStyle::Primitive primitive, const QStyleOption *option ) const |
|
1624 { |
1018 { |
1625 Q_D( const HbStyle ); |
1019 |
1626 |
|
1627 switch(primitive){ |
1020 switch(primitive){ |
1628 case P_PushButton_icon: |
1021 case P_PushButton_icon: |
1629 { |
1022 { |
1630 if (const HbStyleOptionPushButton *opt = |
1023 if (const HbStyleOptionPushButton *opt = |
1631 qstyleoption_cast<const HbStyleOptionPushButton*>(option)) { |
1024 qstyleoption_cast<const HbStyleOptionPushButton*>(option)) { |
1632 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1025 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1633 //iconItem->setIconName(opt->icon.iconName()); |
1026 //iconItem->setIconName(opt->icon.iconName()); |
1634 iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there |
1027 iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there |
1635 iconItem->setMode(d->iconMode(opt->state)); |
1028 iconItem->setMode(iconMode(opt->state)); |
1636 iconItem->setState(d->iconState(opt->state)); |
1029 iconItem->setState(iconState(opt->state)); |
1637 iconItem->setAlignment(Qt::AlignCenter); |
1030 iconItem->setAlignment(Qt::AlignCenter); |
1638 } |
1031 } |
1639 break; |
1032 break; |
1640 } |
1033 } |
1641 case P_GroupBoxHeading_icon: |
1034 case P_GroupBoxHeading_icon: |
2560 else { |
1951 else { |
2561 name = QLatin1String("qtg_fr_slider_v_frame_pressed"); |
1952 name = QLatin1String("qtg_fr_slider_v_frame_pressed"); |
2562 } |
1953 } |
2563 } else { |
1954 } else { |
2564 name = QLatin1String("qtg_fr_slider_v_frame_disabled"); |
1955 name = QLatin1String("qtg_fr_slider_v_frame_disabled"); |
2565 |
1956 |
2566 } |
1957 } |
2567 type = HbFrameDrawer::ThreePiecesVertical; |
1958 type = HbFrameDrawer::ThreePiecesVertical; |
2568 } |
1959 } |
2569 |
1960 |
2570 frameItem->frameDrawer().setFrameGraphicsName(name); |
1961 frameItem->frameDrawer().setFrameGraphicsName(name); |
2571 frameItem->frameDrawer().setFrameType(type); |
1962 frameItem->frameDrawer().setFrameType(type); |
2572 frameItem->frameDrawer().setFillWholeRect(true); |
1963 frameItem->frameDrawer().setFillWholeRect(true); |
2573 break; |
1964 } |
2574 } |
1965 break; |
2575 } |
1966 } |
2576 |
1967 |
2577 case P_Slider_thumb: { |
1968 case P_Slider_thumb: { |
2578 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option)){ |
1969 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option)){ |
2579 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1970 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2580 // Set pixmap name and bounding rect |
1971 // Set pixmap name and bounding rect |
2581 QString thumbPath; |
1972 QString thumbPath; |
2582 if(opt->thumbPath.isNull()) |
1973 if(opt->thumbPath.isNull()) |
2583 { |
1974 { |
2584 thumbPath=d->logicalName(HbStyle::P_Slider_thumb, option); |
1975 thumbPath=logicalName(HbStylePrivate::P_Slider_thumb, option); |
2585 } |
1976 } |
2586 else |
1977 else |
2587 { |
1978 { |
2588 thumbPath=opt->thumbPath; |
1979 thumbPath=opt->thumbPath; |
2589 iconItem->setAlignment(Qt::AlignCenter); |
1980 } |
2590 } |
1981 iconItem->setAlignment(Qt::AlignCenter); |
2591 iconItem->setIconName(thumbPath); |
1982 iconItem->setIconName(thumbPath); |
2592 iconItem->setAspectRatioMode(Qt::KeepAspectRatio); |
1983 iconItem->setAspectRatioMode(Qt::KeepAspectRatio); |
2593 } |
1984 } |
2594 break; |
1985 break; |
2595 } |
1986 } |
2596 case HbStyle::P_SliderElement_increase: |
1987 case HbStylePrivate::P_SliderElement_increase: |
2597 { |
1988 { |
2598 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
1989 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2599 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1990 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2600 iconItem->setZValue(1.0); |
1991 iconItem->setZValue(1.0); |
2601 iconItem->setMode(d->iconMode(opt->state)); |
1992 iconItem->setMode(iconMode(opt->state)); |
2602 iconItem->setState(d->iconState(opt->state)); |
1993 iconItem->setState(iconState(opt->state)); |
2603 if ( !opt->sliderElementIcon.isNull() ){ |
1994 if ( !opt->sliderElementIcon.isNull() ){ |
2604 iconItem->setIcon(opt->sliderElementIcon); |
1995 iconItem->setIcon(opt->sliderElementIcon); |
2605 } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { |
1996 } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { |
2606 iconItem->setIconName(QLatin1String("qtg_mono_vol_up")); |
1997 iconItem->setIconName(QLatin1String("qtg_mono_vol_up")); |
2607 } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) { |
1998 } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) { |
2608 iconItem->setIconName(QLatin1String("qtg_mono_zoom_in")); |
1999 iconItem->setIconName(QLatin1String("qtg_mono_zoom_in")); |
2609 } |
2000 } |
2610 } |
2001 } |
2611 break; |
2002 break; |
2612 } |
2003 } |
2613 case HbStyle::P_SliderElement_decrease: |
2004 case HbStylePrivate::P_SliderElement_decrease: |
2614 { |
2005 { |
2615 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2006 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2616 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2007 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2617 iconItem->setZValue(1.0); |
2008 iconItem->setZValue(1.0); |
2618 iconItem->setMode(d->iconMode(opt->state)); |
2009 iconItem->setMode(iconMode(opt->state)); |
2619 iconItem->setState(d->iconState(opt->state)); |
2010 iconItem->setState(iconState(opt->state)); |
2620 if ( !opt->sliderElementIcon.isNull() ){ |
2011 if ( !opt->sliderElementIcon.isNull() ){ |
2621 iconItem->setIcon(opt->sliderElementIcon); |
2012 iconItem->setIcon(opt->sliderElementIcon); |
2622 } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { |
2013 } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { |
2623 iconItem->setIconName(QLatin1String("qtg_mono_vol_down")); |
2014 iconItem->setIconName(QLatin1String("qtg_mono_vol_down")); |
2624 } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) { |
2015 } else if (opt->sliderType == HbStyleOptionSlider::ZoomType) { |
2625 iconItem->setIconName(QLatin1String("qtg_mono_zoom_out")); |
2016 iconItem->setIconName(QLatin1String("qtg_mono_zoom_out")); |
2626 } |
2017 } |
2627 } |
2018 } |
2628 break; |
2019 break; |
2629 } |
2020 } |
2630 case HbStyle::P_SliderElement_icon: |
2021 case HbStylePrivate::P_SliderElement_icon: |
2631 { |
2022 { |
2632 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2023 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2633 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2024 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2634 iconItem->setZValue(1.0); |
2025 iconItem->setZValue(1.0); |
2635 iconItem->setMode(d->iconMode(opt->state)); |
2026 iconItem->setMode(iconMode(opt->state)); |
2636 iconItem->setState(d->iconState(opt->state)); |
2027 iconItem->setState(iconState(opt->state)); |
2637 if ( !opt->sliderElementIcon.isNull() ){ |
2028 if ( !opt->sliderElementIcon.isNull() ){ |
2638 iconItem->setIcon(opt->sliderElementIcon); |
2029 iconItem->setIcon(opt->sliderElementIcon); |
2639 } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { |
2030 } else if ( opt->sliderType == HbStyleOptionSlider::VolumeType) { |
2640 if( opt->state & QStyle::State_Sunken) { |
2031 if( opt->state & QStyle::State_Sunken) { |
2641 iconItem->setIconName(QLatin1String("qtg_mono_speaker_off")); |
2032 iconItem->setIconName(QLatin1String("qtg_mono_speaker_off")); |
2858 textItem->setTextDefaultColor(opt->color); |
2211 textItem->setTextDefaultColor(opt->color); |
2859 } |
2212 } |
2860 textItem->setText(opt->text); |
2213 textItem->setText(opt->text); |
2861 } |
2214 } |
2862 break; |
2215 break; |
2863 |
2216 case P_Popup_heading_frame: { |
2864 case P_MenuItem_submenuindicator: |
|
2865 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) { |
|
2866 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
2867 Q_UNUSED(opt) |
|
2868 iconItem->setIconName(QLatin1String("qtg_mono_options_menu")); |
|
2869 } |
|
2870 break; |
|
2871 |
|
2872 case P_MenuItem_checkindicator: |
|
2873 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) { |
|
2874 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
2875 if (opt->checked) { |
|
2876 iconItem->setIconName(QLatin1String("qtg_small_tick")); |
|
2877 } else { |
|
2878 iconItem->setIcon(HbIcon()); |
|
2879 } |
|
2880 } |
|
2881 break; |
|
2882 |
|
2883 case P_MenuItem_separator: |
|
2884 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) { |
|
2885 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
2886 Q_UNUSED(opt) |
|
2887 iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); |
|
2888 iconItem->setAlignment(Qt::AlignCenter); |
|
2889 iconItem->setIconName(QLatin1String("qtg_graf_popup_separator")); |
|
2890 } |
|
2891 break; |
|
2892 |
|
2893 case P_ScrollBar_groove: |
|
2894 if (const HbStyleOptionScrollBar *opt = qstyleoption_cast<const HbStyleOptionScrollBar *>(option)) { |
|
2895 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
|
2896 if (opt->interactive) { |
|
2897 if (opt->groovePressed) { |
|
2898 if (opt->orientation == Qt::Vertical) { |
|
2899 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
|
2900 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_active_frame_pressed")); |
|
2901 } else { |
|
2902 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
2903 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_active_frame_pressed")); |
|
2904 } |
|
2905 } else { |
|
2906 if (opt->orientation == Qt::Vertical) { |
|
2907 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
|
2908 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_active_frame_normal")); |
|
2909 } else { |
|
2910 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
2911 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_active_frame_normal")); |
|
2912 } |
|
2913 } |
|
2914 } else { |
|
2915 if (opt->orientation == Qt::Vertical) { |
|
2916 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
|
2917 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_frame")); |
|
2918 } else { |
|
2919 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
2920 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_frame")); |
|
2921 } |
|
2922 } |
|
2923 |
|
2924 frameItem->frameDrawer().setFillWholeRect(true); |
|
2925 } |
|
2926 break; |
|
2927 |
|
2928 case P_ScrollBar_handle: |
|
2929 if (const HbStyleOptionScrollBar *opt = qstyleoption_cast<const HbStyleOptionScrollBar *>(option)) { |
|
2930 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
|
2931 if (opt->interactive) { |
|
2932 if (opt->thumbPressed) { |
|
2933 if (opt->orientation == Qt::Vertical) { |
|
2934 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
|
2935 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_active_handle_pressed")); |
|
2936 } else { |
|
2937 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
2938 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_active_handle_pressed")); |
|
2939 } |
|
2940 } else { |
|
2941 if (opt->orientation == Qt::Vertical) { |
|
2942 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
|
2943 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_active_handle_normal")); |
|
2944 } else { |
|
2945 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
2946 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_active_handle_normal")); |
|
2947 } |
|
2948 } |
|
2949 } else { |
|
2950 if (opt->orientation == Qt::Vertical) { |
|
2951 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
|
2952 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_v_handle")); |
|
2953 } else { |
|
2954 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
2955 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_scroll_h_handle")); |
|
2956 } |
|
2957 } |
|
2958 frameItem->frameDrawer().setFillWholeRect(true); |
|
2959 } |
|
2960 break; |
|
2961 |
|
2962 case P_Popup_background: |
|
2963 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
|
2964 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
|
2965 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
2966 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup")); |
|
2967 frameItem->setGeometry(opt->boundingRect); |
|
2968 } |
|
2969 break; |
|
2970 case P_Popup_background_weak: |
|
2971 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
|
2972 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
|
2973 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
2974 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_secondary")); |
|
2975 frameItem->setGeometry(opt->boundingRect); |
|
2976 } |
|
2977 break; |
|
2978 |
|
2979 case P_Popup_heading_frame: |
|
2980 if (const HbStyleOptionPopup *opt = qstyleoption_cast<const HbStyleOptionPopup *>(option)) { |
2217 if (const HbStyleOptionPopup *opt = qstyleoption_cast<const HbStyleOptionPopup *>(option)) { |
2981 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
2218 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
2982 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
2219 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
2983 frameItem->setGeometry(opt->boundingRect); |
2220 frameItem->setGeometry(opt->boundingRect); |
2984 if (opt->headingMode == QIcon::Active) { |
2221 if (opt->headingMode == QIcon::Active) { |
3107 icon->setIcon(opt->icon); |
2328 icon->setIcon(opt->icon); |
3108 } |
2329 } |
3109 } |
2330 } |
3110 break; |
2331 break; |
3111 case P_ListViewItem_text: |
2332 case P_ListViewItem_text: |
3112 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
2333 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_text no more supported. Use refactored styling"); |
3113 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
|
3114 |
|
3115 if (opt->index == 1) { |
|
3116 if (opt->multilineSecondaryTextSupported) { |
|
3117 if (opt->minimumLines != -1) { |
|
3118 // min & max secondary text row counts set by app |
|
3119 Hb::TextWrapping wrapping = Hb::TextNoWrap; |
|
3120 if ( opt->minimumLines != 1 |
|
3121 || opt->maximumLines != 1) { |
|
3122 wrapping = Hb::TextWordWrap; |
|
3123 } |
|
3124 textItem->setTextWrapping(wrapping); |
|
3125 textItem->setMinimumLines(opt->minimumLines); |
|
3126 textItem->setMaximumLines(opt->maximumLines); |
|
3127 } else { |
|
3128 // min & max secondary text row counts not set by app. Allow setting those from .css |
|
3129 // Needed when multilineSecondaryTextSupported changed from FALSE to TRUE and |
|
3130 // min & max secondary text row counts has not bee set by app |
|
3131 HbWidgetBasePrivate *widgetBasePrivate = d->widgetBasePrivate(textItem); |
|
3132 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false); |
|
3133 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false); |
|
3134 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); |
|
3135 } |
|
3136 } else { |
|
3137 // min & max secondary text row counts must always be 1. They cannot be overridden by .css |
|
3138 textItem->setTextWrapping(Hb::TextNoWrap); |
|
3139 textItem->setMinimumLines(1); |
|
3140 textItem->setMaximumLines(1); |
|
3141 } |
|
3142 } // else - default values from .css still in use |
|
3143 setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1)); |
|
3144 textItem->setText(opt->content.value<QString>()); |
|
3145 } |
|
3146 break; |
2334 break; |
3147 case P_ListViewItem_richtext: |
2335 case P_ListViewItem_richtext: |
3148 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
2336 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_richtext no more supported. Use refactored styling"); |
3149 HbRichTextItem *label = static_cast<HbRichTextItem*>(item); |
|
3150 label->setText(opt->content.value<QString>()); |
|
3151 |
|
3152 setItemName(label, QLatin1String("text-") + QString::number(opt->index + 1)); |
|
3153 } |
|
3154 break; |
2337 break; |
3155 case P_ListViewItem_icon: |
2338 case P_ListViewItem_icon: |
3156 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
2339 Q_ASSERT_X(false, "HbStyle" , "P_ListViewItem_icon no more supported. Use refactored styling"); |
3157 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
3158 |
|
3159 setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1)); |
|
3160 if (iconItem->zValue() != opt->index + 1) { |
|
3161 iconItem->setZValue(opt->index + 1); |
|
3162 } |
|
3163 |
|
3164 if (opt->content.canConvert<HbIcon>()){ |
|
3165 iconItem->setIcon(opt->content.value<HbIcon>()); |
|
3166 } if (opt->content.canConvert<QIcon>()){ |
|
3167 iconItem->setIcon(opt->content.value<QIcon>()); |
|
3168 } |
|
3169 } |
|
3170 break; |
2340 break; |
3171 case P_GridViewItem_icon: |
2341 case P_GridViewItem_icon: |
3172 if (const HbStyleOptionGridViewItem*opt = qstyleoption_cast<const HbStyleOptionGridViewItem*>(option)) { |
2342 Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_icon no more supported. Use refactored styling"); |
3173 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2343 break; |
3174 iconItem->setIcon(opt->icon); |
|
3175 iconItem->setAlignment(Qt::AlignCenter); |
|
3176 iconItem->setAspectRatioMode(Qt::KeepAspectRatio); |
|
3177 } |
|
3178 break; |
|
3179 |
|
3180 case P_ColorGridViewItem_colorIcon: |
|
3181 if (const HbStyleOptionColorGridViewItem* opt = qstyleoption_cast<const HbStyleOptionColorGridViewItem*>(option)) { |
|
3182 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
3183 if(!iconItem) |
|
3184 return; |
|
3185 iconItem->setColor(opt->color); |
|
3186 iconItem->setZValue(iconItem->parentItem()->zValue()+2); |
|
3187 } |
|
3188 break; |
|
3189 case P_ColorGridViewItem_borderIcon: |
|
3190 if (const HbStyleOptionColorGridViewItem* opt = qstyleoption_cast<const HbStyleOptionColorGridViewItem*>(option)) { |
|
3191 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
3192 if(!iconItem) |
|
3193 return; |
|
3194 iconItem->setIconName(opt->borderIcon); |
|
3195 iconItem->setColor(opt->borderColor); |
|
3196 iconItem->setZValue(iconItem->parentItem()->zValue()+1); |
|
3197 } |
|
3198 break; |
|
3199 case P_ColorGridViewItem_checkIcon: |
|
3200 if (const HbStyleOptionColorGridViewItem* opt = qstyleoption_cast<const HbStyleOptionColorGridViewItem*>(option)) { |
|
3201 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
3202 if(!iconItem) |
|
3203 return; |
|
3204 Q_UNUSED(opt); |
|
3205 iconItem->setZValue(iconItem->parentItem()->zValue()+3); |
|
3206 } |
|
3207 break; |
|
3208 |
|
3209 |
2344 |
3210 case P_GridViewItem_text: |
2345 case P_GridViewItem_text: |
3211 if (const HbStyleOptionGridViewItem*opt = qstyleoption_cast<const HbStyleOptionGridViewItem*>(option)) { |
2346 Q_ASSERT_X(false, "HbStyle" , "P_GridViewItem_text no more supported. Use refactored styling"); |
3212 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
|
3213 textItem->setAlignment(Qt::AlignCenter); |
|
3214 textItem->setText(opt->text); |
|
3215 } |
|
3216 break; |
2347 break; |
3217 |
2348 |
3218 case P_ItemHighlight_background: |
2349 case P_ItemHighlight_background: |
3219 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
2350 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
3220 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
2351 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
3222 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
2353 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3223 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_highlight")); |
2354 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_highlight")); |
3224 frameItem->setGeometry(opt->boundingRect); |
2355 frameItem->setGeometry(opt->boundingRect); |
3225 } |
2356 } |
3226 break; |
2357 break; |
3227 case P_ToolBarExtension_background: |
|
3228 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
|
3229 Q_UNUSED(opt); |
|
3230 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
|
3231 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3232 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_trans")); |
|
3233 } |
|
3234 break; |
|
3235 case P_SliderPopup_background: |
2358 case P_SliderPopup_background: |
3236 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
2359 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
3237 Q_UNUSED(opt) |
2360 Q_UNUSED(opt) |
3238 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
2361 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
3239 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
2362 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3240 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_trans")); |
2363 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_popup_trans")); |
3241 } |
2364 } |
3242 break; |
2365 break; |
|
2366 |
3243 case P_ProgressBar_frame: |
2367 case P_ProgressBar_frame: |
3244 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) { |
|
3245 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
|
3246 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
3247 if(opt->orientation == Qt::Horizontal){ |
|
3248 |
|
3249 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_frame")); |
|
3250 } |
|
3251 |
|
3252 else{ |
|
3253 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
|
3254 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_frame")); |
|
3255 } |
|
3256 // frameItem->frameDrawer().setFillWholeRect(true); |
|
3257 } |
|
3258 break; |
2368 break; |
3259 case P_ProgressBar_track: |
2369 case P_ProgressBar_track: |
3260 |
|
3261 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) { |
|
3262 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
|
3263 if(!frameItem->isVisible()) { |
|
3264 break; |
|
3265 } |
|
3266 |
|
3267 if(opt->orientation == Qt::Horizontal){ |
|
3268 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
3269 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_filled")); |
|
3270 } |
|
3271 else{ |
|
3272 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
|
3273 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_filled")); |
|
3274 } |
|
3275 |
|
3276 frameItem->setMaximum(opt->maximum); |
|
3277 frameItem->setMinimum(opt->minimum); |
|
3278 frameItem->setValue(opt->progressValue); |
|
3279 frameItem->setInverted(opt->inverted); |
|
3280 //frameItem->setGeometry(opt->rect); |
|
3281 frameItem->setOrientation(opt->orientation); |
|
3282 frameItem->update(); |
|
3283 } |
|
3284 break; |
2370 break; |
3285 case P_ProgressBar_waittrack: |
2371 case P_ProgressBar_waittrack: |
3286 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) { |
2372 break; |
3287 HbRepeatIconItem *iconItem = static_cast<HbRepeatIconItem*>(item); |
|
3288 iconItem->setOrientation(opt->orientation); |
|
3289 if( !iconItem->isVisible() ) { |
|
3290 break; |
|
3291 } |
|
3292 if(opt->orientation == Qt::Horizontal){ |
|
3293 iconItem->setName(QLatin1String("qtg_graf_progbar_h_wait")); |
|
3294 } |
|
3295 else{ |
|
3296 iconItem->setName(QLatin1String("qtg_graf_progbar_v_wait")); |
|
3297 } |
|
3298 if(opt->stopWaitAnimation){ |
|
3299 iconItem->stopAnimation(); |
|
3300 } |
|
3301 } |
|
3302 break; |
|
3303 |
|
3304 case P_ProgressSlider_frame: |
2373 case P_ProgressSlider_frame: |
3305 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
2374 break; |
3306 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
2375 case P_ProgressSlider_track: |
3307 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
2376 break; |
3308 if (opt->disableState ) { |
2377 case P_ProgressSlider_slidertrack: |
3309 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled")); |
2378 break; |
3310 } |
2379 case P_ProgressBar_mintext: |
3311 else { |
2380 break; |
3312 if(opt->pressedState) { |
2381 case P_ProgressBar_maxtext: |
3313 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed")); |
2382 break; |
3314 } |
2383 case P_RatingSlider_frame: |
3315 else { |
2384 break; |
3316 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal")); |
2385 case P_RatingSlider_track: |
3317 } |
2386 break; |
3318 } |
2387 case P_ProgressSliderHandle_icon: |
3319 frameItem->frameDrawer().setFillWholeRect(true); |
2388 break; |
3320 //frameItem->update(); |
2389 |
3321 } |
|
3322 break; |
|
3323 case P_ProgressSlider_track: // The ProgressValue Mask |
|
3324 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
|
3325 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
|
3326 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
3327 |
|
3328 if (opt->disableState ) { |
|
3329 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded_disabled")); |
|
3330 } |
|
3331 else { |
|
3332 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded")); |
|
3333 } |
|
3334 frameItem->frameDrawer().setFillWholeRect(true); |
|
3335 frameItem->setMaximum(opt->maximum); |
|
3336 frameItem->setMinimum(opt->minimum); |
|
3337 frameItem->setValue(opt->progressValue); |
|
3338 frameItem->setInverted(opt->inverted); |
|
3339 frameItem->setOrientation(opt->orientation); |
|
3340 frameItem->update(); |
|
3341 } |
|
3342 break; |
|
3343 |
|
3344 case P_ProgressSlider_slidertrack: // The Slider Position Mask |
|
3345 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
|
3346 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
|
3347 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
3348 if (opt->disableState ) { |
|
3349 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played_disabled")); |
|
3350 } |
|
3351 else { |
|
3352 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played")); |
|
3353 } |
|
3354 frameItem->frameDrawer().setFillWholeRect(true); |
|
3355 frameItem->setMaximum(opt->maximum); |
|
3356 frameItem->setMinimum(opt->minimum); |
|
3357 frameItem->setValue(opt->progressSliderValue); |
|
3358 frameItem->setInverted(opt->inverted); |
|
3359 frameItem->setOrientation(opt->orientation); |
|
3360 frameItem->update(); |
|
3361 } |
|
3362 break; |
|
3363 case P_ProgressBar_mintext: { |
|
3364 if (const HbStyleOptionProgressBar *opt = |
|
3365 qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) { |
|
3366 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
|
3367 if(!item) { |
|
3368 return; |
|
3369 } |
|
3370 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
|
3371 textItem->setText(opt->minText); |
|
3372 } |
|
3373 break; |
|
3374 } |
|
3375 |
|
3376 case P_ProgressBar_maxtext: { |
|
3377 if (const HbStyleOptionProgressBar *opt = |
|
3378 qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) { |
|
3379 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
|
3380 if(!item) { |
|
3381 return; |
|
3382 } |
|
3383 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
|
3384 textItem->setText(opt->maxText); |
|
3385 } |
|
3386 break; |
|
3387 } |
|
3388 |
|
3389 case P_RatingSlider_frame:{ |
|
3390 if (const HbStyleOptionRatingSlider *opt = qstyleoption_cast<const HbStyleOptionRatingSlider *>(option)) { |
|
3391 HbRepeatItem *repeatItem = static_cast<HbRepeatItem*>(item); |
|
3392 repeatItem->setRepeatingNumber(opt->noOfStars); |
|
3393 if (!opt->unRatedGraphicsName.isEmpty()) { |
|
3394 repeatItem->setName(opt->unRatedGraphicsName); |
|
3395 } |
|
3396 else { |
|
3397 if(opt->disableState) { |
|
3398 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_disabled")); |
|
3399 |
|
3400 } |
|
3401 else { |
|
3402 if(opt->pressedState) { |
|
3403 |
|
3404 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_pressed")); |
|
3405 } |
|
3406 else { |
|
3407 |
|
3408 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated")); |
|
3409 } |
|
3410 } |
|
3411 } |
|
3412 repeatItem->setGeometry(opt->boundingRect); |
|
3413 repeatItem->update(); |
|
3414 } |
|
3415 break; |
|
3416 } |
|
3417 |
|
3418 case P_RatingSlider_track:{ |
|
3419 if (const HbStyleOptionRatingSlider *opt = qstyleoption_cast<const HbStyleOptionRatingSlider *>(option)) { |
|
3420 HbRepeatMaskItem *repeatItem = static_cast<HbRepeatMaskItem*>(item); |
|
3421 repeatItem->setMaskValue(opt->progressValue); |
|
3422 repeatItem->setMaximum(opt->noOfIntervals); |
|
3423 repeatItem->setInverted(opt->inverted); |
|
3424 repeatItem->setRepeatingNumber(opt->noOfStars); |
|
3425 if (!opt->ratedGraphicsName.isEmpty()) { |
|
3426 repeatItem->setName(opt->ratedGraphicsName); |
|
3427 } |
|
3428 else { |
|
3429 if(opt->disableState) { |
|
3430 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_disabled")); |
|
3431 |
|
3432 |
|
3433 } |
|
3434 else { |
|
3435 |
|
3436 if(opt->pressedState) { |
|
3437 |
|
3438 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_pressed")); |
|
3439 } |
|
3440 else { |
|
3441 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated")); |
|
3442 } |
|
3443 } |
|
3444 } |
|
3445 repeatItem->setGeometry(opt->boundingRect); |
|
3446 repeatItem->update(); |
|
3447 } |
|
3448 break; |
|
3449 } |
|
3450 case P_ProgressSliderHandle_icon: |
|
3451 if (const HbStyleOptionProgressSliderHandle *opt = qstyleoption_cast<const HbStyleOptionProgressSliderHandle *>(option)) { |
|
3452 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
3453 |
|
3454 if(!opt->handleIcon.isNull()) { |
|
3455 iconItem->setIconName(opt->handleIcon.iconName()); |
|
3456 } |
|
3457 else { |
|
3458 if(opt->pressedState) { |
|
3459 iconItem->setIconName(QLatin1String("qtg_graf_progslider_handle_pressed")); |
|
3460 } |
|
3461 else { |
|
3462 iconItem->setIconName(QLatin1String("qtg_graf_progslider_handle_normal")); |
|
3463 } |
|
3464 } |
|
3465 } |
|
3466 break; |
|
3467 case P_QueryInputMode_image: |
2390 case P_QueryInputMode_image: |
3468 |
2391 |
3469 /* if (const HbStyleOptionInputPopup *opt = qstyleoption_cast<const HbStyleOptionInputPopup *>(option)){ |
2392 /* if (const HbStyleOptionInputPopup *opt = qstyleoption_cast<const HbStyleOptionInputPopup *>(option)){ |
3470 if (HbIconItem *iconItem = static_cast<HbIconItem*>(item)) { |
2393 if (HbIconItem *iconItem = static_cast<HbIconItem*>(item)) { |
3471 iconItem->setIcon(*opt->modeIcon); |
2394 iconItem->setIcon(*opt->modeIcon); |
3472 iconItem->setPos(opt->editRect.width() - opt->modeIcon->width() - 6,opt->editRect.top()-3); |
2395 iconItem->setPos(opt->editRect.width() - opt->modeIcon->width() - 6,opt->editRect.top()-3); |
3473 } |
2396 } |
3474 }*/ |
2397 }*/ |
3475 break; |
2398 break; |
3476 case P_ItemViewItem_background: |
2399 case P_ItemViewItem_background: |
3477 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) { |
2400 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_background no more supported. Use refactored styling"); |
3478 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
3479 iconItem->setGeometry(opt->boundingRect); |
|
3480 if (opt->background.canConvert<HbIcon>()){ |
|
3481 iconItem->setIcon(opt->background.value<HbIcon>()); |
|
3482 } else if (opt->background.canConvert<QBrush>()){ |
|
3483 iconItem->setBrush(opt->background.value<QBrush>()); |
|
3484 } |
|
3485 } |
|
3486 |
|
3487 break; |
2401 break; |
3488 case P_ItemViewItem_frame: |
2402 case P_ItemViewItem_frame: |
3489 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) { |
2403 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_frame no more supported. Use refactored styling"); |
3490 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
|
3491 frameItem->setGeometry(opt->boundingRect); |
|
3492 |
|
3493 if (opt->background.canConvert<HbFrameBackground>()) { |
|
3494 HbFrameBackground frame = opt->background.value<HbFrameBackground>(); |
|
3495 frameItem->frameDrawer().setFrameType(frame.frameType()); |
|
3496 frameItem->frameDrawer().setFrameGraphicsName(frame.frameGraphicsName()); |
|
3497 } else if (opt->viewItemType == Hb::ItemType_TreeViewItem) { |
|
3498 if (opt->modelItemType == Hb::ParentItem) { |
|
3499 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3500 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
|
3501 QLatin1String("qtg_fr_popup_list_parent_normal") : QLatin1String("qtg_fr_list_parent_normal")); |
|
3502 } else if (opt->modelItemType == Hb::SeparatorItem) { |
|
3503 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3504 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator")); |
|
3505 } else { |
|
3506 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3507 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
|
3508 QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal")); |
|
3509 } |
|
3510 } else if ( opt->viewItemType == Hb::ItemType_ListViewItem |
|
3511 || opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) { |
|
3512 if (opt->modelItemType == Hb::SeparatorItem) { |
|
3513 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3514 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator")); |
|
3515 } else { |
|
3516 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3517 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
|
3518 QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal")); |
|
3519 } |
|
3520 } else if (opt->viewItemType == Hb::ItemType_GridViewItem |
|
3521 || opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) { |
|
3522 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3523 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
|
3524 QLatin1String("qtg_fr_popup_grid_normal") : QLatin1String("qtg_fr_grid_normal")); |
|
3525 } |
|
3526 else{ |
|
3527 frameItem->frameDrawer().setFrameGraphicsName(QString()); |
|
3528 } |
|
3529 } |
|
3530 break; |
2404 break; |
3531 case P_ItemViewItem_focus: |
2405 case P_ItemViewItem_focus: |
3532 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) { |
2406 Q_ASSERT_X(false, "HbStyle" , "P_ItemViewItem_focus no more supported. Use refactored styling"); |
3533 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
2407 break; |
3534 frameItem->setGeometry(opt->boundingRect); |
|
3535 |
|
3536 if (opt->viewItemType == Hb::ItemType_TreeViewItem |
|
3537 || opt->viewItemType == Hb::ItemType_ListViewItem |
|
3538 || opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) { |
|
3539 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3540 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
|
3541 QLatin1String("qtg_fr_popup_list_pressed") : QLatin1String("qtg_fr_list_pressed")); |
|
3542 } else if ( opt->viewItemType == Hb::ItemType_GridViewItem |
|
3543 || opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) { |
|
3544 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
3545 frameItem->frameDrawer().setFrameGraphicsName(opt->insidePopup ? |
|
3546 QLatin1String("qtg_fr_popup_grid_pressed") : QLatin1String("qtg_fr_grid_pressed")); |
|
3547 } else { |
|
3548 setItemName(frameItem,QString()); |
|
3549 frameItem->frameDrawer().setFrameGraphicsName(QString()); |
|
3550 } |
|
3551 } |
|
3552 break; |
|
3553 case P_SelectionControl_selectionstart://fallthrough |
|
3554 case P_SelectionControl_selectionend://fallthrough |
|
3555 { |
|
3556 if (HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item)) { |
|
3557 iconItem->setSize(iconItem->preferredSize()); |
|
3558 } |
|
3559 break; |
|
3560 } |
|
3561 case P_TreeViewItem_expandicon: |
2408 case P_TreeViewItem_expandicon: |
3562 if (const HbStyleOptionTreeViewItem *opt = qstyleoption_cast<const HbStyleOptionTreeViewItem *>(option)) { |
2409 Q_ASSERT_X(false, "HbStyle" , "P_TreeViewItem_expandicon no more supported. Use refactored styling"); |
3563 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2410 break; |
3564 if (opt->expanded) { |
|
3565 iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_collapse") : QLatin1String("qtg_small_collapse")); |
|
3566 } else { |
|
3567 iconItem->setIconName(opt->insidePopup ? QLatin1String("qtg_mono_expand") : QLatin1String("qtg_small_expand")); |
|
3568 } |
|
3569 } |
|
3570 break; |
|
3571 case P_ScrollArea_continuationbottom: |
|
3572 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) { |
|
3573 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_graf_list_mask_b")); |
|
3574 frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece); |
|
3575 frameItem->setZValue(1); |
|
3576 } |
|
3577 break; |
|
3578 case P_ScrollArea_continuationtop: |
|
3579 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) { |
|
3580 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_graf_list_mask_t")); |
|
3581 frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece); |
|
3582 frameItem->setZValue(1); |
|
3583 } |
|
3584 break; |
|
3585 case P_ScrollArea_continuationright: |
|
3586 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) { |
|
3587 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_graf_list_mask_r")); |
|
3588 frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece); |
|
3589 frameItem->setZValue(1); |
|
3590 } |
|
3591 break; |
|
3592 case P_ScrollArea_continuationleft: |
|
3593 if (HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>( item ) ) { |
|
3594 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_graf_list_mask_l")); |
|
3595 frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece); |
|
3596 frameItem->setZValue(1); |
|
3597 } |
|
3598 break; |
|
3599 |
|
3600 case P_TumbleView_background: |
2411 case P_TumbleView_background: |
3601 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
2412 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3602 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
2413 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3603 |
2414 |
3604 //Temporary source to avoid introducing new style primitive for selection dialog mark widget background item. |
2415 //Temporary source to avoid introducing new style primitive for selection dialog mark widget background item. |
3638 } |
2449 } |
3639 } |
2450 } |
3640 break; |
2451 break; |
3641 |
2452 |
3642 case P_TumbleView_highlight: |
2453 case P_TumbleView_highlight: |
3643 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
2454 /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3644 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
2455 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3645 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri"); |
2456 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri"); |
3646 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
2457 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3647 frameItem->setZValue(3); |
2458 frameItem->setZValue(-1); |
3648 //TODO:temp fix, issue with css rule picking in derived class |
2459 //TODO:temp fix, issue with css rule picking in derived class |
3649 |
2460 |
3650 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
2461 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
3651 Q_UNUSED(opt); |
2462 Q_UNUSED(opt); |
3652 } |
2463 } |
3653 |
2464 |
3654 } |
2465 }*/ |
3655 break; |
2466 break; |
3656 |
2467 |
3657 case P_IndexFeedback_popup_text: |
2468 case P_IndexFeedback_popup_text: |
3658 if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) { |
2469 Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_text no more supported. Use refactored styling"); |
3659 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
|
3660 textItem->setFontSpec(opt->fontSpec); |
|
3661 textItem->setGeometry(opt->textRect); |
|
3662 textItem->setText(opt->text); |
|
3663 } |
|
3664 break; |
2470 break; |
3665 case P_IndexFeedback_popup_background: |
2471 case P_IndexFeedback_popup_background: |
3666 if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) { |
2472 Q_ASSERT_X(false, "HbStyle" , "P_IndexFeedback_popup_background no more supported. Use refactored styling"); |
3667 if (HbFrameItem* frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
|
3668 frameItem->setGeometry(opt->popupRect); |
|
3669 } |
|
3670 } |
|
3671 break; |
2473 break; |
3672 case P_DateTimePicker_background: |
2474 case P_DateTimePicker_background: |
3673 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
2475 /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3674 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
2476 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3675 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg"); |
2477 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg"); |
3676 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
2478 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3677 frameItem->setZValue(-5); |
2479 frameItem->setZValue(-5); |
3678 //TODO:temp fix, issue with css rule picking in derived class |
2480 //TODO:temp fix, issue with css rule picking in derived class |
3679 //frameItem->setGeometry(opt->boundingRect); |
2481 //frameItem->setGeometry(opt->boundingRect); |
3680 Q_UNUSED(opt); |
2482 Q_UNUSED(opt); |
3681 } |
2483 } |
3682 } |
2484 }*/ |
3683 break; |
2485 break; |
3684 case P_DateTimePicker_frame: |
2486 case P_DateTimePicker_frame: |
3685 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
2487 /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3686 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
2488 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3687 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay"); |
2489 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay"); |
3688 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
2490 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3689 frameItem->setZValue(1); |
2491 frameItem->setZValue(1); |
3690 //TODO:temp fix, issue with css rule picking in derived class |
2492 //TODO:temp fix, issue with css rule picking in derived class |
3691 //frameItem->setGeometry(opt->boundingRect); |
2493 //frameItem->setGeometry(opt->boundingRect); |
3692 Q_UNUSED(opt); |
2494 Q_UNUSED(opt); |
3693 } |
2495 } |
3694 } |
2496 }*/ |
3695 break; |
2497 break; |
3696 case P_DateTimePicker_separator: |
2498 case P_DateTimePicker_separator: |
3697 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
2499 /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3698 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
2500 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3699 frameItem->frameDrawer().setFrameGraphicsName("qtg_graf_tumbler_divider"); |
2501 frameItem->frameDrawer().setFrameGraphicsName("qtg_graf_tumbler_divider"); |
3700 frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece); |
2502 frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece); |
3701 frameItem->setZValue(2); |
2503 frameItem->setZValue(2); |
3702 //TODO:temp fix, issue with css rule picking in derived class |
2504 //TODO:temp fix, issue with css rule picking in derived class |
3703 |
2505 |
3704 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
2506 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
3705 Q_UNUSED(opt); |
2507 Q_UNUSED(opt); |
3706 } |
2508 } |
3707 |
2509 |
3708 } |
2510 }*/ |
3709 break; |
2511 break; |
3710 case P_InputDialog_text: |
2512 case P_InputDialog_text: |
3711 if (const HbStyleOptionInputDialog *opt = |
2513 if (const HbStyleOptionInputDialog *opt = |
3712 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
2514 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
3713 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
2515 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3714 if(!item) { |
2516 if(!item) { |
3715 return; |
2517 return; |
3716 } |
2518 } |
3717 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
|
3718 textItem->setText(opt->text); |
2519 textItem->setText(opt->text); |
3719 } |
2520 } |
3720 break; |
2521 break; |
3721 case P_InputDialog_additionaltext: |
2522 case P_InputDialog_additionaltext: |
3722 if (const HbStyleOptionInputDialog *opt = |
2523 if (const HbStyleOptionInputDialog *opt = |
3723 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
2524 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
3724 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
2525 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3725 if(!item) { |
2526 if(!item) { |
3726 return; |
2527 return; |
3727 } |
2528 } |
3728 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
|
3729 textItem->setText(opt->additionalText); |
2529 textItem->setText(opt->additionalText); |
3730 } |
2530 } |
3731 break; |
2531 break; |
3732 |
2532 |
3733 default: |
2533 default: |
4149 #endif |
2959 #endif |
4150 anchor->setDirection( prop.mAnchorDir ); |
2960 anchor->setDirection( prop.mAnchorDir ); |
4151 } |
2961 } |
4152 } |
2962 } |
4153 |
2963 |
4154 |
|
4155 |
|
4156 #define NODEPTR_N(x) HbCss::StyleSelector::NodePtr n = {n.ptr = (void *)x}; |
|
4157 /*! |
2964 /*! |
4158 Polishes the appearance of the given \a widget. |
2965 Polishes the appearance of the given \a widget. |
4159 |
2966 |
4160 This method should be called only by HbWidget (base class). The inherited |
2967 This method should be called only by HbWidget (base class). The inherited |
4161 classes should not call this method directly, but use the HbWidget's |
2968 classes should not call this method directly, but use the HbWidget's |
4162 polish loop instead. |
2969 polish loop instead. |
4163 |
2970 |
4164 This method reads the CSS and WidgetML definition for a given widget and positions |
2971 This method reads the CSS and WidgetML definition for a given widget and positions |
4165 the sub-elements inside it. Note you need to set the names for the sub-elements |
2972 the sub-elements inside it. Note you need to set the names for the sub-elements |
4166 with HbStyle::setItemName method before this method is called. |
2973 with HbStyle::HbStyle::setItemName method before this method is called. |
4167 |
2974 |
4168 Note that this method is heavy on the system resources and should be called |
2975 Note that this method is heavy on the system resources and should be called |
4169 absolutely when necessary by the widget. |
2976 absolutely when necessary by the widget. |
4170 |
2977 |
4171 \param widget, HbWidget to be polished |
2978 \param widget HbWidget to be polished |
4172 \param params, style parameters to be returned to the caller |
2979 \param params style parameters to be returned to the caller |
4173 */ |
2980 */ |
4174 void HbStyle::polish(HbWidget *widget, HbStyleParameters ¶ms) |
2981 void HbStyle::polish(HbWidget *widget, HbStyleParameters ¶ms) |
4175 { |
2982 { |
4176 Q_D( HbStyle ); |
2983 Q_D( HbStyle ); |
4177 #ifdef HBSTYLE_DEBUG |
2984 #ifdef HBSTYLE_DEBUG |
4178 qDebug() << "HbStyle::polish : -- -- -- --"; |
2985 qDebug() << "HbStyle::polish : -- -- -- -- ENTER"; |
4179 #endif |
2986 #endif |
4180 if( !widget ) { |
2987 if( !widget ) { |
|
2988 #ifdef HBSTYLE_DEBUG |
|
2989 qDebug() << "HbStyle::polish : -- -- -- -- EXIT"; |
|
2990 #endif |
4181 return; |
2991 return; |
4182 } |
2992 } |
4183 #ifdef HBSTYLE_DEBUG |
2993 #ifdef HBSTYLE_DEBUG |
4184 qDebug() << "HbStyle::polish : Polishing" << widget->metaObject()->className(); |
2994 qDebug() << "HbStyle::polish : Polishing" << widget->metaObject()->className(); |
4185 #endif |
2995 #endif |
4186 |
2996 |
4187 HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts); |
2997 HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts); |
4188 if(!styleLoader){ |
2998 if(!styleLoader){ |
4189 #ifdef HBSTYLE_DEBUG |
2999 #ifdef HBSTYLE_DEBUG |
4190 qDebug() << "HbStyle::polish : HbLayeredStyleLoader returned a null pointer."; |
3000 qDebug() << "HbStyle::polish : HbLayeredStyleLoader returned a null pointer."; |
|
3001 qDebug() << "HbStyle::polish : -- -- -- -- EXIT"; |
4191 #endif |
3002 #endif |
4192 return; |
3003 return; |
4193 } |
3004 } |
4194 HbDeviceProfile profile(HbDeviceProfile::profile(widget)); |
3005 HbDeviceProfile profile(HbDeviceProfile::profile(widget)); |
4195 NODEPTR_N(widget); |
3006 HbCss::StyleSelector::NodePtr n(widget); |
4196 |
3007 |
4197 HbVector<HbCss::StyleRule> styleRules; |
3008 HbVector<HbCss::StyleRule> styleRules = styleLoader->styleRulesForNode(n, profile.orientation()); |
4198 QVariant widgetStyleCache = widget->property( HbStyleRulesCacheId::hbStyleRulesForNodeCache ); |
|
4199 |
|
4200 if(widgetStyleCache.isValid()) { |
|
4201 QString widgetStyleCacheId = widgetStyleCache.toString(); |
|
4202 if (d->styleRulesCache.contains(widgetStyleCacheId)) { |
|
4203 styleRules = d->styleRulesCache.value(widgetStyleCacheId); |
|
4204 } else { |
|
4205 styleRules = styleLoader->styleRulesForNode(n, profile.orientation()); |
|
4206 d->styleRulesCache[widgetStyleCacheId] = styleRules; |
|
4207 } |
|
4208 } else { |
|
4209 styleRules = styleLoader->styleRulesForNode(n, profile.orientation()); |
|
4210 } |
|
4211 |
3009 |
4212 #ifdef HBSTYLE_DEBUG |
3010 #ifdef HBSTYLE_DEBUG |
4213 qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count(); |
3011 qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count(); |
4214 #endif |
3012 #endif |
4215 if (!styleRules.count()) { |
3013 if (!styleRules.count()) { |
|
3014 #ifdef HBSTYLE_DEBUG |
|
3015 qDebug() << "HbStyle::polish : -- -- -- -- EXIT"; |
|
3016 #endif |
4216 return; |
3017 return; |
4217 } |
3018 } |
4218 const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile); |
3019 const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile); |
4219 #ifdef HBSTYLE_DEBUG |
3020 #ifdef HBSTYLE_DEBUG |
4220 qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count(); |
3021 qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count(); |
4221 #endif |
3022 #endif |
4222 d->ensureLayoutParameters(profile); |
3023 d->layoutParameters.init(profile); |
4223 |
3024 |
4224 HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile); |
3025 HbCss::ValueExtractor extractor(decl, profile); |
|
3026 extractor.setLayoutParameters(d->layoutParameters); |
4225 QString layoutName; |
3027 QString layoutName; |
4226 QString sectionName; |
3028 QString sectionName; |
4227 |
3029 |
4228 if ( params.count() ) { |
3030 if ( params.count() ) { |
4229 #ifdef HBSTYLE_DEBUG |
3031 #ifdef HBSTYLE_DEBUG |