phonebookui/pbkcommonui/src/cnthistoryviewitem.cpp
changeset 59 a642906a277a
parent 47 7cbcb2896f0e
child 66 554fe4dbbb59
--- a/phonebookui/pbkcommonui/src/cnthistoryviewitem.cpp	Tue Jul 06 14:05:47 2010 +0300
+++ b/phonebookui/pbkcommonui/src/cnthistoryviewitem.cpp	Wed Aug 18 09:39:00 2010 +0300
@@ -20,6 +20,7 @@
 #include <cnthistorymodel.h>
 #include <hbframedrawer.h>
 #include <hbframeitem.h>
+#include <QGraphicsWidget>
 
 #define NEW_EVENT_FRAME "qtg_fr_list_new_item"
 #define INCOMING_FOCUS_FRAME "qtg_fr_convlist_received_pressed"
@@ -117,4 +118,26 @@
         }
     }
 }
+
+bool CntHistoryViewItem::event(QEvent* e)
+{
+    bool result;
+    if (e->type() == QEvent::GraphicsSceneResize)
+    {
+        // HbAbstractItemView has a performance improvement when drawing backrounds but seems
+        // to screw the layout of history view items. This workaround fixes the issue. There should
+        // be minimal performance drawbacks since GraphicsSceneResize events are quite few.
+        // TODO: Remove this once Orbit changes their implementation. Not known when
+        QGraphicsWidget *frame = static_cast<QGraphicsWidget*>(primitive("frame"));
+        QRectF frameGeometry = frame->geometry();
+        result = HbListViewItem::event(e);
+        frame->setGeometry(frameGeometry);
+    } 
+    else
+    {
+        result = HbListViewItem::event(e);
+    }
+    return result;
+}
+
 // EOF