--- a/src/hbinput/inputwidgets/hbinputcheckboxlist.cpp Thu Jul 15 14:03:49 2010 +0100
+++ b/src/hbinput/inputwidgets/hbinputcheckboxlist.cpp Thu Jul 22 16:36:53 2010 +0100
@@ -22,13 +22,13 @@
** Nokia at developer.feedback@nokia.com.
**
****************************************************************************/
+#include "hbinputcheckboxlist_p.h"
#include <hblistwidget.h>
#include <hblistwidgetitem.h>
#include <hbdataformmodelitem.h>
#include <hbdataformmodel.h>
-
-#include "hbinputcheckboxlist_p.h"
+#include "hbwidget_p.h"
/// @cond
@@ -44,7 +44,7 @@
Constructs checkbox list
*/
HbInputCheckBoxList::HbInputCheckBoxList(QGraphicsItem *parent)
- : HbDataFormViewItem(parent), d_ptr(new HbInputCheckBoxListPrivate())
+ : HbDataFormViewItem(parent), d_ptr(new HbInputCheckBoxListPrivate())
{
}
@@ -59,21 +59,21 @@
/*!
Returns a new copy of this object
*/
-HbAbstractViewItem* HbInputCheckBoxList::createItem()
+HbAbstractViewItem *HbInputCheckBoxList::createItem()
{
return new HbInputCheckBoxList(*this);
}
/*!
\reimp
-Returns true if \a model index is supported, otherwise returns false.
+Returns true if \a index is supported, otherwise returns false.
*/
bool HbInputCheckBoxList::canSetModelIndex(const QModelIndex &index) const
{
- HbDataFormModelItem::DataItemType itemType =
+ HbDataFormModelItem::DataItemType itemType =
static_cast<HbDataFormModelItem::DataItemType>(index.data(HbDataFormModelItem::ItemTypeRole).toInt());
- if(itemType == HbDataFormModelItem::CustomItemBase) {
+ if (itemType == HbDataFormModelItem::CustomItemBase) {
return true;
} else {
return false;
@@ -87,8 +87,8 @@
{
Q_D(HbInputCheckBoxList);
QModelIndex itemIndex = modelIndex();
- HbDataFormModelItem *modelItem = static_cast<HbDataFormModelItem*>(
- static_cast<HbDataFormModel*>(itemView()->model())->itemFromIndex(itemIndex));
+ HbDataFormModelItem *modelItem = static_cast<HbDataFormModelItem *>(
+ static_cast<HbDataFormModel *>(itemView()->model())->itemFromIndex(itemIndex));
QList<QVariant> selectedValues = modelItem->contentWidgetData(QString("selectedItems")).toList();
selectedValues.replace(index.row(), !selectedValues.at(index.row()).toBool());
@@ -100,26 +100,30 @@
} else {
d->mListWidget->setCurrentIndex(viewItem->modelIndex(), QItemSelectionModel::Deselect);
}
- }
+}
/*!
Creates a widget for showing checkbox list
*/
-HbWidget* HbInputCheckBoxList::createCustomWidget()
+HbWidget *HbInputCheckBoxList::createCustomWidget()
{
Q_D(HbInputCheckBoxList);
QModelIndex itemIndex = modelIndex();
- HbDataFormModelItem *modelItem = static_cast<HbDataFormModelItem*>(
- static_cast<HbDataFormModel*>(itemView()->model())->itemFromIndex(itemIndex));
+ HbDataFormModelItem *modelItem = static_cast<HbDataFormModelItem *>(
+ static_cast<HbDataFormModel *>(itemView()->model())->itemFromIndex(itemIndex));
d->mListWidget = new HbListWidget();
d->mListWidget->setSelectionMode(HbAbstractItemView::MultiSelection);
d->mListWidget->contentWidget()->setContentsMargins(10, 10, 10, 10);
- d->mListWidget->setBackgroundItem(HbStyle::P_DataItem_background);
+ // get listwidget's widget private ptr
+ HbWidgetPrivate *priv = static_cast<HbWidgetPrivate*>(HbWidgetBasePrivate::d_ptr(d->mListWidget));
+ priv->setBackgroundItem(HbStyle::P_DataItem_background);
+ d->mListWidget->setScrollDirections(0);
+
QStringList items = modelItem->contentWidgetData(QString("items")).toStringList();
- foreach(QString itemName, items) {
+ foreach(const QString &itemName, items) {
HbListWidgetItem *item = new HbListWidgetItem();
item->setData(QVariant(itemName), Qt::DisplayRole);
d->mListWidget->addItem(item);
@@ -138,14 +142,14 @@
connect(d->mListWidget, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &)));
- return d->mListWidget;
+ return d->mListWidget;
}
/*!
Copy constructor for private use.
*/
HbInputCheckBoxList::HbInputCheckBoxList(const HbInputCheckBoxList &other)
- : HbDataFormViewItem(other), d_ptr(new HbInputCheckBoxListPrivate())
+ : HbDataFormViewItem(other), d_ptr(new HbInputCheckBoxListPrivate())
{
}