src/hbwidgets/itemviews/hbgridviewitem_p.cpp
changeset 34 ed14f46c0e55
parent 0 16d8024aca5e
--- a/src/hbwidgets/itemviews/hbgridviewitem_p.cpp	Mon Oct 04 17:49:30 2010 +0300
+++ b/src/hbwidgets/itemviews/hbgridviewitem_p.cpp	Mon Oct 18 18:23:13 2010 +0300
@@ -25,6 +25,8 @@
 
 #include <hbgridviewitem.h>
 #include <hbgridviewitem_p.h>
+#include <hbiconitem.h>
+#include <hbtextitem.h>
 
 #include <hbeffect.h>
 
@@ -106,10 +108,13 @@
     if (    mTextValid
         &&  !mTextItem) {
         mItemsChanged = true;
-        mTextItem = q->style()->createPrimitive(HbStyle::P_GridViewItem_text, q);
-       }
-    else if (   !mTextValid
-             && mTextItem) {
+        mTextItem = q->style()->createPrimitive(HbStyle::PT_TextItem, QLatin1String("text"), q);
+        HbTextItem *textItem = qobject_cast<HbTextItem*>(mTextItem);
+        if (textItem) {
+            textItem->setAlignment(Qt::AlignCenter);
+        }
+    } else if (   !mTextValid
+               && mTextItem) {
         mItemsChanged = true;
         delete mTextItem;
         mTextItem = 0;
@@ -140,7 +145,12 @@
     if (    mIconValid
         &&  !mIconItem) {
         mItemsChanged = true;
-        mIconItem = q->style()->createPrimitive(HbStyle::P_GridViewItem_icon, q);
+        mIconItem = q->style()->createPrimitive(HbStyle::PT_IconItem, QLatin1String("icon"), 0);
+        mIconItem->setParentItem(q); // To enable asynchronous icon loading.
+        HbIconItem *iconItem = qobject_cast<HbIconItem*>(mIconItem);
+        if (iconItem) {
+            iconItem->setAlignment(Qt::AlignCenter);
+        }
     }
     else if (   !mIconValid
             &&  mIconItem) {