247 \var HbDataFormModelItem::RadioButtonListItem |
237 \var HbDataFormModelItem::RadioButtonListItem |
248 RadioButtonListItem: This itemType is for radio button list type of data item |
238 RadioButtonListItem: This itemType is for radio button list type of data item |
249 |
239 |
250 RadioButtonListItem will appear in three display modes |
240 RadioButtonListItem will appear in three display modes |
251 |
241 |
252 automatic : radioButtonList item appear as embedded( inline) if it contains less than four items and |
242 - Automatic : radioButtonList item appear as embedded( inline) if it contains less than four items and |
253 if more than three items then selected items are displayed as text on a PushButton and when pushbutton |
243 if more than three items then selected items are displayed as text on a PushButton and when pushbutton |
254 clicked it lunches popup. Automatic mode is set as the default mode. |
244 clicked it lunches popup. Automatic mode is set as the default mode. |
255 |
245 |
256 embedded : Application can set these items as always embedded(inline) by setting the property "displayMode" |
246 - Embedded : Application can set these items as always embedded(inline) by setting the property "displayMode" |
257 with value of property as "embedded" |
247 with value of property as "embedded" |
258 |
248 |
259 popup : Application can set these items as always popup by setting the property "displayMode" |
249 - Popup : Application can set these items as always popup by setting the property "displayMode" |
260 with value of property as "popup" |
250 with value of property as "popup" |
261 HbDataFormModelItem *radioItem = model->appendDataItem(HbDataFormModelItem::RadioButtonListItem, |
251 HbDataFormModelItem *radioItem = model->appendDataItem(HbDataFormModelItem::RadioButtonListItem, |
262 QString("Caller Tone")); |
252 QString("Caller Tone")); |
263 radioItem->setContentWidgetData(QString("displayMode"),QString("embedded")); |
253 radioItem->setContentWidgetData(QString("displayMode"),QString("embedded")); |
264 radioItem->setContentWidgetData(QString("displayMode"),QString("automatic")); |
254 radioItem->setContentWidgetData(QString("displayMode"),QString("automatic")); |
270 \var HbDataFormModelItem::MultiselectionItem |
260 \var HbDataFormModelItem::MultiselectionItem |
271 MultiselectionItem: This itemType is for multi selection type of data item. |
261 MultiselectionItem: This itemType is for multi selection type of data item. |
272 |
262 |
273 MultiSelectionListItem will appear in three display modes |
263 MultiSelectionListItem will appear in three display modes |
274 |
264 |
275 automatic : radioButtonList item appear as embedded( inline) if it contains less than four items and |
265 - Automatic : radioButtonList item appear as embedded( inline) if it contains less than four items and |
276 if more than three items then selected items are displayed as text on a PushButton and when pushbutton |
266 if more than three items then selected items are displayed as text on a PushButton and when pushbutton |
277 clicked it lunches popup. Automatic mode is set as the default mode. |
267 clicked it lunches popup. Automatic mode is set as the default mode. |
278 |
268 |
279 embedded : Application can set these items as always embedded(inline) by setting the property "displayMode" |
269 - Embedded : Application can set these items as always embedded(inline) by setting the property "displayMode" |
280 with value of property as "embedded" |
270 with value of property as "embedded" |
281 |
271 |
282 popup : Application can set these items as always popup by setting the property "displayMode" |
272 - Popup : Application can set these items as always popup by setting the property "displayMode" |
283 with value of property as "popup" |
273 with value of property as "popup" |
284 HbDataFormModelItem *radioItem = model->appendDataItem(HbDataFormModelItem::MultiSelectionListItem, |
274 HbDataFormModelItem *radioItem = model->appendDataItem(HbDataFormModelItem::MultiSelectionListItem, |
285 QString("Caller Tone")); |
275 QString("Caller Tone")); |
286 radioItem->setContentWidgetData(QString("displayMode"),QString("embedded")); |
276 radioItem->setContentWidgetData(QString("displayMode"),QString("embedded")); |
287 radioItem->setContentWidgetData(QString("displayMode"),QString("automatic")); |
277 radioItem->setContentWidgetData(QString("displayMode"),QString("automatic")); |
441 |
440 |
442 } |
441 } |
443 |
442 |
444 /*! |
443 /*! |
445 @beta |
444 @beta |
|
445 |
446 Removes the child item at the given \a index. The item at \a index is |
446 Removes the child item at the given \a index. The item at \a index is |
447 deleted. |
447 deleted. |
448 |
448 |
449 \sa removeChildren |
449 \sa removeChildren |
450 */ |
450 */ |
451 void HbDataFormModelItem::removeChild(int index) |
451 void HbDataFormModelItem::removeChild(int index) |
452 { |
452 { |
453 Q_D(HbDataFormModelItem); |
453 if( ( index < 0 ) || ( index >= childCount() ) ) { |
454 |
454 return; |
|
455 } |
|
456 Q_D(HbDataFormModelItem); |
455 HbDataFormModel* model = static_cast<HbDataFormModel*>(d->mModel); |
457 HbDataFormModel* model = static_cast<HbDataFormModel*>(d->mModel); |
456 if(model) { |
458 |
457 model->d_func()->rowsAboutToBeRemoved(this, index, index); |
459 HbDataFormModelItem *item = d->mChildItems.at(index); |
|
460 if( item ) { |
|
461 int childCount = item->childCount(); |
|
462 for ( int childIndex = 0; childIndex < childCount ;childIndex++) { |
|
463 item->removeChild(0); |
|
464 } |
|
465 if( model ) { |
|
466 model->d_func()->rowsAboutToBeRemoved(this, index, index); |
|
467 } |
458 HbDataFormModelItem *item = d->mChildItems.takeAt(index); |
468 HbDataFormModelItem *item = d->mChildItems.takeAt(index); |
459 if ( item ) { |
469 delete item; |
460 delete item; |
470 item = 0; |
461 item = 0; |
471 if( model ) { |
462 } |
472 model->d_func()->rowsRemoved(); |
463 model->d_func()->rowsRemoved(); |
473 } |
464 } |
474 } |
465 else { |
475 } |
466 HbDataFormModelItem *item = d->mChildItems.takeAt(index); |
476 |
467 if ( item ) { |
477 /*! |
468 delete item; |
478 @beta |
469 item = 0; |
479 |
470 } |
|
471 } |
|
472 |
|
473 } |
|
474 |
|
475 /*! |
|
476 @beta |
|
477 Removes the given no of \a count of childitems from the given \a startindex. The |
480 Removes the given no of \a count of childitems from the given \a startindex. The |
478 items are deleted. |
481 items are deleted. |
479 |
482 |
480 \sa removeChild |
483 \sa removeChild |
481 */ |
484 */ |
482 void HbDataFormModelItem::removeChildren(int startIndex, int count) |
485 void HbDataFormModelItem::removeChildren(int startIndex, int count) |
483 { |
486 { |
484 Q_D(HbDataFormModelItem); |
487 if( ( startIndex < 0 ) || ( startIndex > childCount() ) || ( count <= 0 )) { |
485 |
488 return; |
486 HbDataFormModel* model = static_cast<HbDataFormModel*>(d->mModel); |
489 } |
487 model->d_func()->rowsAboutToBeRemoved(this, startIndex, startIndex + count -1); |
490 |
488 for(int index = 0; index < count ;index++) { |
491 if( startIndex + count > childCount() ) { |
489 HbDataFormModelItem *item = d->mChildItems.takeAt(0); |
492 return; |
490 if ( item ) { |
493 } |
491 delete item; |
494 |
492 item = 0; |
495 for(int index = 0; index < count ;index++) { |
493 } |
496 removeChild(startIndex); |
494 } |
497 } |
495 model->d_func()->rowsRemoved(); |
498 } |
496 } |
499 |
497 |
500 /*! |
498 /*! |
501 @beta |
499 @beta |
502 |
500 Returns the child item at the given \a index. |
503 Returns the child item at the given \a index. |
501 Returns 0 if \a index passed in greater than count or less than 0. |
504 Returns 0 if \a index passed in greater than count or less than 0. |
502 |
505 |
503 \sa indexOf |
506 \sa indexOf |
504 */ |
507 */ |
611 - VolumeSliderItem: HbVolumeSlider property should be used |
617 - VolumeSliderItem: HbVolumeSlider property should be used |
612 - CheckBoxItem: HbCheckBox property should be used |
618 - CheckBoxItem: HbCheckBox property should be used |
613 - TextItem: HbLineEdit property should be used |
619 - TextItem: HbLineEdit property should be used |
614 - ToggleValueItem: HbPushButton(text and additionalText) property should be used |
620 - ToggleValueItem: HbPushButton(text and additionalText) property should be used |
615 - RadioButtonListItem: HbRadioButtonList property should be used |
621 - RadioButtonListItem: HbRadioButtonList property should be used |
616 - MultiselectionItem: HbListDialog property should be used |
622 - MultiselectionItem: HbListWidget property should be used |
617 - ComboBoxItem: HbComboBox property should be used |
623 - ComboBoxItem: HbComboBox property should be used |
618 */ |
624 */ |
619 void HbDataFormModelItem::setContentWidgetData( |
625 void HbDataFormModelItem::setContentWidgetData( |
620 const QString& propertyName ,const QVariant &value) |
626 const QString& propertyName ,const QVariant &value) |
621 { |
627 { |
622 Q_D(HbDataFormModelItem); |
628 Q_D(HbDataFormModelItem); |
623 d->mProperties.remove(propertyName); |
629 d->setContentWidgetData(propertyName, value); |
624 d->mProperties.insert(propertyName,value); |
630 |
625 d->mDirtyProperty = propertyName; |
631 d->mDirtyProperty = propertyName; |
626 |
|
627 HbDataFormModel *data_model = static_cast<HbDataFormModel*>(d->mModel); |
632 HbDataFormModel *data_model = static_cast<HbDataFormModel*>(d->mModel); |
628 if(data_model) { |
633 if(data_model) { |
629 QModelIndex index = data_model->indexFromItem(this); |
634 QModelIndex index = data_model->indexFromItem(this); |
630 emit data_model->dataChanged(index, index); |
635 emit data_model->dataChanged(index, index); |
631 } |
636 } |
632 } |
637 } |
633 |
638 |
634 /*! |
639 /*! |
635 @beta |
640 @beta |
|
641 |
636 Returns the property \a value for the given \a propertyName. |
642 Returns the property \a value for the given \a propertyName. |
637 */ |
643 */ |
638 QVariant HbDataFormModelItem::contentWidgetData(const QString& propertyName ) const |
644 QVariant HbDataFormModelItem::contentWidgetData(const QString& propertyName ) const |
639 { |
645 { |
640 Q_D(const HbDataFormModelItem); |
646 Q_D(const HbDataFormModelItem); |
641 return d->mProperties.value(propertyName); |
647 return d->mProperties.value(propertyName); |
642 } |
648 } |
|
649 |
643 /*! |
650 /*! |
644 @beta |
651 @beta |
|
652 |
645 Returns all properties with values which was set in HbDataFormModelItem. |
653 Returns all properties with values which was set in HbDataFormModelItem. |
646 */ |
654 */ |
647 QHash<QString, QVariant> HbDataFormModelItem::contentWidgetData() const |
655 QHash<QString, QVariant> HbDataFormModelItem::contentWidgetData() const |
648 { |
656 { |
649 Q_D(const HbDataFormModelItem); |
657 Q_D(const HbDataFormModelItem); |
650 return d->mProperties; |
658 return d->mProperties; |
651 } |
659 } |
|
660 |
652 /*! |
661 /*! |
653 @beta |
662 @beta |
|
663 |
654 Sets \a parent as a parent to this item. |
664 Sets \a parent as a parent to this item. |
655 It only sets the parent pointer. It doesnt put the item in the |
665 It only sets the parent pointer. It does not put the item in the |
656 hierarchy. |
666 hierarchy. |
657 */ |
667 */ |
658 void HbDataFormModelItem::setParent(HbDataFormModelItem* parent) |
668 void HbDataFormModelItem::setParent(HbDataFormModelItem* parent) |
659 { |
669 { |
660 Q_D(HbDataFormModelItem); |
670 Q_D(HbDataFormModelItem); |
661 d->mParentItem=parent; |
671 d->mParentItem=parent; |
662 } |
672 } |
663 |
673 |
664 /*! |
674 /*! |
665 @beta |
675 @beta |
|
676 |
666 Returns the parent of the this data item. |
677 Returns the parent of the this data item. |
667 */ |
678 */ |
668 HbDataFormModelItem* HbDataFormModelItem::parent() const |
679 HbDataFormModelItem* HbDataFormModelItem::parent() const |
669 { |
680 { |
670 Q_D(const HbDataFormModelItem); |
681 Q_D(const HbDataFormModelItem); |
671 return d->mParentItem; |
682 return d->mParentItem; |
672 } |
683 } |
673 |
684 |
674 /*! |
685 /*! |
675 @beta |
686 @beta |
|
687 |
676 Sets \a type as a DataItemType for this data item. |
688 Sets \a type as a DataItemType for this data item. |
677 */ |
689 */ |
678 void HbDataFormModelItem::setType(HbDataFormModelItem::DataItemType type) |
690 void HbDataFormModelItem::setType(HbDataFormModelItem::DataItemType type) |
679 { |
691 { |
680 setData(ItemTypeRole,type); |
692 setData(ItemTypeRole,type); |
681 } |
693 } |
682 |
694 |
683 /*! |
695 /*! |
684 @beta |
696 @beta |
|
697 |
685 Returns the DataItemType of the this item. |
698 Returns the DataItemType of the this item. |
686 */ |
699 */ |
687 HbDataFormModelItem::DataItemType HbDataFormModelItem::type() const |
700 HbDataFormModelItem::DataItemType HbDataFormModelItem::type() const |
688 { |
701 { |
689 return static_cast<HbDataFormModelItem::DataItemType>(data(ItemTypeRole).toInt()); |
702 return static_cast<HbDataFormModelItem::DataItemType>(data(ItemTypeRole).toInt()); |
690 } |
703 } |
691 |
704 |
692 /*! |
705 /*! |
693 @beta |
706 @beta |
|
707 |
694 Sets the \a label to the item. This is valid only if the type is other than FormPageItem, |
708 Sets the \a label to the item. This is valid only if the type is other than FormPageItem, |
695 GroupItem and GroupPageItem. |
709 GroupItem and GroupPageItem. |
696 */ |
710 */ |
697 void HbDataFormModelItem::setLabel(const QString& label) |
711 void HbDataFormModelItem::setLabel(const QString& label) |
698 { |
712 { |
699 setData(LabelRole,label); |
713 setData(LabelRole,label); |
700 } |
714 } |
701 |
715 |
702 /*! |
716 /*! |
703 @beta |
717 @beta |
|
718 |
704 Returns the label of the item. |
719 Returns the label of the item. |
705 */ |
720 */ |
706 QString HbDataFormModelItem::label() const |
721 QString HbDataFormModelItem::label() const |
707 { |
722 { |
708 return data(LabelRole).toString(); |
723 return data(LabelRole).toString(); |
709 } |
724 } |
710 |
725 |
711 /*! |
726 /*! |
712 @beta |
727 @beta |
|
728 |
713 Sets the \a icon to the item. This is valid only if the type is other than FormPageItem, |
729 Sets the \a icon to the item. This is valid only if the type is other than FormPageItem, |
714 GroupItem and GroupPageItem. |
730 GroupItem and GroupPageItem. |
715 */ |
731 */ |
716 void HbDataFormModelItem::setIcon(const QString& icon) |
732 void HbDataFormModelItem::setIcon(const QString& icon) |
717 { |
733 { |
718 setData(Qt::DecorationRole,icon); |
734 setData(Qt::DecorationRole,icon); |
719 } |
735 } |
720 |
736 |
721 /*! |
737 /*! |
722 @beta |
738 @beta |
|
739 |
723 Returns the icon of the item. |
740 Returns the icon of the item. |
724 */ |
741 */ |
725 QString HbDataFormModelItem::icon() const |
742 QString HbDataFormModelItem::icon() const |
726 { |
743 { |
727 return data(Qt::DecorationRole).toString(); |
744 return data(Qt::DecorationRole).toString(); |
728 } |
745 } |
729 |
746 |
730 /* |
747 /*! |
731 QHash<QString, QVariant> HbDataFormModelItem::getContentWidgetValues() |
748 @beta |
732 { |
749 |
733 Q_D(const HbDataFormModelItem); |
|
734 return d->mProperties; |
|
735 }*/ |
|
736 |
|
737 /*! |
|
738 Sets whether the item is enabled. |
750 Sets whether the item is enabled. |
739 |
751 |
740 If enabled is true, the item is \a enabled, meaning that the user can interact with the item |
752 If enabled is true, the item is \a enabled, meaning that the user can interact with the item |
741 if \a enabled is false, the user cannot interact with the item. |
753 if \a enabled is false, the user cannot interact with the item. |
742 */ |
754 */ |
757 } |
769 } |
758 } |
770 } |
759 } |
771 } |
760 |
772 |
761 /*! |
773 /*! |
762 Returns true if the item is enabled; otherwise returns false. |
774 @beta |
|
775 Returns true if the item is enabled otherwise returns false. |
763 */ |
776 */ |
764 bool HbDataFormModelItem::isEnabled() const |
777 bool HbDataFormModelItem::isEnabled() const |
765 { |
778 { |
766 Q_D(const HbDataFormModelItem); |
779 Q_D(const HbDataFormModelItem); |
767 return d->mFlags & Qt::ItemIsEnabled; |
780 return d->mFlags & Qt::ItemIsEnabled; |
768 } |
781 } |
769 |
782 |
770 /*! |
783 /*! |
|
784 @beta |
771 Returns item flags for this item. |
785 Returns item flags for this item. |
772 */ |
786 */ |
773 Qt::ItemFlags HbDataFormModelItem::flags() const |
787 Qt::ItemFlags HbDataFormModelItem::flags() const |
774 { |
788 { |
775 Q_D(const HbDataFormModelItem); |
789 Q_D(const HbDataFormModelItem); |
776 return d->mFlags; |
790 return d->mFlags; |
777 } |
791 } |
778 |
792 |
779 /*! |
793 /*! |
780 @proto |
794 @beta |
781 Sets the \a description to the item. This is valid only if the type is GroupItem or |
795 Sets the \a description to the item. This is valid only if the type is GroupItem or |
782 DataItem. Its not valid for GroupPageItem and FormPageItem. |
796 DataItem. Its not valid for GroupPageItem and FormPageItem. |
783 */ |
797 */ |
784 void HbDataFormModelItem::setDescription(const QString& description) |
798 void HbDataFormModelItem::setDescription(const QString& description) |
785 { |
799 { |
786 setData(DescriptionRole , description); |
800 setData(DescriptionRole , description); |
787 } |
801 } |
788 |
802 |
789 /*! |
803 /*! |
790 @proto |
804 @beta |
791 Returns the description of the item. |
805 Returns the description of the item. |
792 */ |
806 */ |
793 QString HbDataFormModelItem::description() const |
807 QString HbDataFormModelItem::description() const |
794 { |
808 { |
795 return data(DescriptionRole).toString(); |
809 return data(DescriptionRole).toString(); |