equal
deleted
inserted
replaced
20 #include <hbdataformmodelitem.h> |
20 #include <hbdataformmodelitem.h> |
21 #include <hblineedit.h> |
21 #include <hblineedit.h> |
22 #include <hbinputeditorinterface.h> |
22 #include <hbinputeditorinterface.h> |
23 #include <qgraphicslinearlayout.h> |
23 #include <qgraphicslinearlayout.h> |
24 #include <hblabel.h> |
24 #include <hblabel.h> |
|
25 #include <hbabstractitemview.h> |
|
26 #include <hbdataformmodel.h> |
25 |
27 |
26 SettingsDataFormCustomItem::SettingsDataFormCustomItem(QGraphicsItem *parent) : |
28 SettingsDataFormCustomItem::SettingsDataFormCustomItem(QGraphicsItem *parent) : |
27 HbDataFormViewItem(parent) |
29 HbDataFormViewItem(parent),mLineEdit(NULL) |
28 { |
30 { |
29 } |
31 } |
30 |
32 |
31 SettingsDataFormCustomItem::~SettingsDataFormCustomItem() |
33 SettingsDataFormCustomItem::~SettingsDataFormCustomItem() |
32 { |
34 { |
43 static_cast<HbDataFormModelItem::DataItemType> |
45 static_cast<HbDataFormModelItem::DataItemType> |
44 ( modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt() ); |
46 ( modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt() ); |
45 switch (itemType) |
47 switch (itemType) |
46 { |
48 { |
47 case HbDataFormModelItem::CustomItemBase : |
49 case HbDataFormModelItem::CustomItemBase : |
48 { |
50 { |
49 HbLineEdit* mLineEdit = new HbLineEdit(); |
51 mLineEdit = new HbLineEdit(); |
50 mLineEdit->setText(QString("8080")); |
|
51 HbEditorInterface editorInterface(mLineEdit); |
52 HbEditorInterface editorInterface(mLineEdit); |
52 editorInterface.setMode(HbInputModeNumeric); |
53 editorInterface.setMode(HbInputModeNumeric); |
53 editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); |
54 editorInterface.setInputConstraints(HbEditorConstraintFixedInputMode); |
54 return mLineEdit; |
55 return mLineEdit; |
55 } |
56 } |
61 bool SettingsDataFormCustomItem::canSetModelIndex( const QModelIndex& aIndex ) const |
62 bool SettingsDataFormCustomItem::canSetModelIndex( const QModelIndex& aIndex ) const |
62 { |
63 { |
63 int itemType = aIndex.data(HbDataFormModelItem::ItemTypeRole).toInt(); |
64 int itemType = aIndex.data(HbDataFormModelItem::ItemTypeRole).toInt(); |
64 return itemType == HbDataFormModelItem::CustomItemBase; |
65 return itemType == HbDataFormModelItem::CustomItemBase; |
65 } |
66 } |
|
67 |
|
68 void SettingsDataFormCustomItem::restore() |
|
69 { |
|
70 HbDataFormViewItem::restore(); |
|
71 HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>( |
|
72 modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); |
|
73 if( itemType == HbDataFormModelItem::CustomItemBase ) { |
|
74 QModelIndex itemIndex = modelIndex(); |
|
75 HbDataFormModelItem *modelItem = static_cast<HbDataFormModelItem*>( |
|
76 static_cast<HbDataFormModel*>(itemView()->model())->itemFromIndex(itemIndex)); |
|
77 QString port = modelItem->contentWidgetData("text").toString(); |
|
78 qDebug("port is %d",port.toInt()); |
|
79 mLineEdit->setText(port); |
|
80 } |
|
81 } |