src/hbwidgets/dataform/hbdataformviewitem_p.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 3 11d3954df52a
--- a/src/hbwidgets/dataform/hbdataformviewitem_p.cpp	Mon May 03 12:48:33 2010 +0300
+++ b/src/hbwidgets/dataform/hbdataformviewitem_p.cpp	Fri May 14 16:09:54 2010 +0300
@@ -39,7 +39,7 @@
 #include <hblineedit.h>
 #include <hbradiobuttonlist.h>
 #include <hbcombobox.h>
-#include <hbstyleoptiondataformviewitem.h>
+#include <hbstyleoptiondataformviewitem_p.h>
 #include <hbselectiondialog.h>
 #include <hbpushbutton.h>
 #include <hbaction.h>
@@ -59,6 +59,7 @@
     mButton = new HbPushButton( );
 
     QGraphicsLinearLayout* layout = new QGraphicsLinearLayout( Qt::Horizontal );
+    layout->setContentsMargins(0, 0, 0, 0);
     layout->addItem( mButton );
     
     setLayout( layout );
@@ -149,6 +150,7 @@
         SIGNAL(itemModified(QPersistentModelIndex, QVariant)));
     if(!layout) {
         layout = new QGraphicsLinearLayout( Qt::Vertical );
+        layout->setContentsMargins(0, 0, 0, 0);
     }
     setLayout( layout );
 }
@@ -354,7 +356,7 @@
 
 void HbRadioItem::dialogClosed(HbAction* action)
 {
-    if(action->text() == "Ok") {
+    if(( action ) && ( action->text() == "Ok" )) {
         // store the selected item to model
         updateModel(mRadioButtonList->selected());        
     }
@@ -373,6 +375,7 @@
     // when clicked on the item        
     mViewItem = static_cast<HbDataFormViewItem*>(parent);
     layout = new QGraphicsLinearLayout(Qt::Horizontal);
+    layout->setContentsMargins(0, 0, 0, 0);
     setLayout(layout);
     
     mModel = static_cast<HbDataFormModel*>(
@@ -470,7 +473,7 @@
         mButton->setTextAlignment(Qt::AlignLeft);
         layout->addItem(mButton);
     }
-    QObject::connect(mButton, SIGNAL(released()), this, SLOT(launchMultiSelectionList()));
+    QObject::connect(mButton, SIGNAL(clicked()), this, SLOT(launchMultiSelectionList()));
 }
 
 void HbMultiSelectionItem::changeMode()
@@ -558,7 +561,7 @@
 
 void HbMultiSelectionItem::dialogClosed(HbAction* action)
 {
-    if( action->text() == "Ok") {
+    if(( action ) && ( action->text() == "Ok" )) {
         //fetch the selected items
         mSelectedItems = mSelectionDialog->selectedItems();
         QString newValue("");
@@ -923,7 +926,7 @@
         case HbDataFormModelItem::SliderItem:
         case HbDataFormModelItem::VolumeSliderItem: {
                 mContentWidget = new HbSlider( Qt::Horizontal, q );
-                mProperty.append( "sliderPosition" );            
+                mProperty.append( "value" );            
                 QObject::connect( mContentWidget, SIGNAL(valueChanged(int)), q,SLOT(save()) );
                 HbStyle::setItemName( mContentWidget, "dataItem_ContentWidget" );                
             }
@@ -983,9 +986,19 @@
             }
             break;
     }
-    //background primitive should get created.
+    //background primitive should get created because if none of the other primitives are created
+    //then createPrimitive and updatePrimitive will never get called and hence background
+    //will not be visible
     createPrimitives();
-    updatePrimitives();
+
+    //update only the background primitive
+    HbStyleOptionDataFormViewItem options;
+    q->initStyleOption(&options);
+    if( mBackgroundItem ) {
+        q->style()->updatePrimitive(
+            mBackgroundItem, HbStyle::P_DataItem_background, &options );
+    }
+
     if ( mContentWidget ) {
         QEvent polishEvent( QEvent::Polish );
         QCoreApplication::sendEvent( mContentWidget, &polishEvent );