--- a/src/hbwidgets/itemviews/hbgridviewitem.cpp Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbwidgets/itemviews/hbgridviewitem.cpp Mon Oct 04 00:38:12 2010 +0300
@@ -26,7 +26,10 @@
#include "hbgridviewitem_p.h"
#include <hbgridviewitem.h>
#include "hbgridview_p.h"
-#include <hbstyleoptiongridviewitem_p.h>
+
+#include <hbstyletextprimitivedata.h>
+#include <hbstylerichtextprimitivedata.h>
+#include <hbstyleiconprimitivedata.h>
#include <QDebug>
/*!
@@ -51,11 +54,11 @@
position selection areas etc.) the view item can use the grid view's internal state model to store this information.To use this feature
implement the state() and setState() functions in the derived class.
- See also HbGridView, HbAbstractItemView, HbAbstractViewItem, HbStyleOptionAbstractViewItem
+ See also HbGridView, HbAbstractItemView, HbAbstractViewItem
\primitives
- \primitive{icon} HbIconItem representing the icon in the HbGridViewItem.
- \primitive{text} HbTextItem representing the text in the HbGridViewItem.
+ \primitive{icon} HbIconItem with item name "icon" representing the icon in the HbGridViewItem.
+ \primitive{text} HbTextItem with item name "text" representing the text in the HbGridViewItem.
*/
@@ -148,6 +151,31 @@
HbAbstractViewItem::updateChildItems();
}
+
+/*!
+ Initializes the HbGridViewItem primitive data.
+
+ This function calls HbWidgetBase::initPrimitiveData().
+ \a primitiveData is data object, which is populated with data. \a primitive is the primitive.
+*/
+void HbGridViewItem::initPrimitiveData(HbStylePrimitiveData *primitiveData,
+ const QGraphicsObject *primitive)
+{
+ Q_ASSERT_X(primitive && primitiveData, "HbGridViewItem::initPrimitiveData" , "NULL data not permitted");
+ Q_D(HbGridViewItem);
+
+ HbWidgetBase::initPrimitiveData(primitiveData, primitive);
+ if (primitiveData->type == HbStylePrimitiveData::SPD_Text) {
+ HbStyleTextPrimitiveData *textPrimitiveData = hbstyleprimitivedata_cast<HbStyleTextPrimitiveData*>(primitiveData);
+ textPrimitiveData->text = d->mText;
+
+ } else if (primitiveData->type == HbStylePrimitiveData::SPD_Icon) {
+ HbStyleIconPrimitiveData *iconPrimitiveData = hbstyleprimitivedata_cast<HbStyleIconPrimitiveData*>(primitiveData);
+ iconPrimitiveData->icon = d->mIcon;
+ }
+}
+
+
/*!
\reimp
*/
@@ -155,34 +183,21 @@
{
Q_D( HbGridViewItem );
if (d->mTextItem || d->mIconItem) {
- HbStyleOptionGridViewItem styleOption;
- initStyleOption(&styleOption);
-
if (d->mTextItem) {
- HbStylePrivate::updatePrimitive(d->mTextItem, HbStylePrivate::P_GridViewItem_text,
- &styleOption);
+ HbStyleTextPrimitiveData textPrimitiveData;
+ initPrimitiveData(&textPrimitiveData, d->mTextItem);
+ style()->updatePrimitive(d->mTextItem, &textPrimitiveData,this);
}
if (d->mIconItem) {
- HbStylePrivate::updatePrimitive(d->mIconItem, HbStylePrivate::P_GridViewItem_icon,
- &styleOption);
+ HbStyleIconPrimitiveData iconPrimitiveData;
+ initPrimitiveData(&iconPrimitiveData, d->mIconItem);
+ style()->updatePrimitive(d->mIconItem, &iconPrimitiveData,this);
}
}
HbAbstractViewItem::updatePrimitives();
}
/*!
- Populates a style option object for this widget based on its current state, and stores the output in \a option.
-*/
-void HbGridViewItem::initStyleOption(HbStyleOptionGridViewItem *option) const
-{
- Q_D( const HbGridViewItem );
-
- HbAbstractViewItem::initStyleOption(option);
- option->icon = d->mIcon;
- option->text = d->mText;
-}
-
-/*!
\reimp
*/
bool HbGridViewItem::selectionAreaContains(const QPointF &position,