44 \class HbSelectionDialog |
44 \class HbSelectionDialog |
45 \brief HbSelectionDialog class allows user to create a list of options out of which one or more can be selected. |
45 \brief HbSelectionDialog class allows user to create a list of options out of which one or more can be selected. |
46 |
46 |
47 SelectionDialog is a modal dialog, for which user has to use default or custom action buttons to dismiss the dialog. |
47 SelectionDialog is a modal dialog, for which user has to use default or custom action buttons to dismiss the dialog. |
48 |
48 |
49 There are 2 modes of selection for SelectionDialog. SingleSelection or MultiSelection.<br> |
49 There are 3 modes of selection for SelectionDialog. NoSelection, SingleSelection or MultiSelection.<br> |
50 |
50 |
51 <b>SingleSelection</b>: User can select one item from the list at a time and the SelectionDialog will be dismissed |
51 <b>SingleSelection</b>: User can select one item from the list at a time and the SelectionDialog will be dismissed |
52 as soon as the user selects the item.<br> |
52 as soon as the user selects the item.Selection is indicated by a tick mark on the left of selected row.<br> |
|
53 |
|
54 <b>NoSelection</b>: User can select one item from the list at a time and the SelectionDialog will be dismissed |
|
55 as soon as the user selects the item.No indicator is show on selection.<br> |
53 |
56 |
54 <b>MultiSelection</b>: User can select multiple items from the list. To dismiss the dialog user has to explicitly press "OK/Cancel" button. |
57 <b>MultiSelection</b>: User can select multiple items from the list. To dismiss the dialog user has to explicitly press "OK/Cancel" button. |
55 User can anytime press "Cancel" button to close the dialog without any selection. |
58 User can anytime press "Cancel" button to close the dialog without any selection. |
56 |
59 |
57 User can provide the data for options in different forms. It can be simple list of strings, list of custom |
60 User can provide the data for options in different forms. It can be simple list of strings, list of custom |
58 items or a model itself. |
61 items or a model itself. |
|
62 |
|
63 Selecion Dialog emit following signal(s): |
|
64 |
|
65 \li selectionChanged(). Emitted when item(s) is/are selected.This signal is emitted only in MultiSelection mode. |
59 |
66 |
60 Below is a snippet of code which shows SelectionDialog in a single selection mode. |
67 Below is a snippet of code which shows SelectionDialog in a single selection mode. |
61 |
68 |
62 \snippet{ultimatecodesnippet/ultimatecodesnippet.cpp,55} |
69 \snippet{ultimatecodesnippet/ultimatecodesnippet.cpp,55} |
63 |
70 |
94 void HbSelectionDialog::showEvent(QShowEvent *event) |
101 void HbSelectionDialog::showEvent(QShowEvent *event) |
95 { |
102 { |
96 HbDialog::showEvent(event); |
103 HbDialog::showEvent(event); |
97 } |
104 } |
98 |
105 |
|
106 /*! |
|
107 Returns string used to denote Mark All items functionality. This display text is located on top of the list, |
|
108 acts as a prompt for the checkbox for marking all items and is valid only in MultiSelection mode. |
|
109 |
|
110 \sa setSelectionTitle() |
|
111 */ |
|
112 QString HbSelectionDialog::selectionTitle() const |
|
113 { |
|
114 Q_D(const HbSelectionDialog); |
|
115 return d->selectionTitle(); |
|
116 } |
|
117 |
|
118 /*! |
|
119 Sets the string used to denote Mark All items functionality. This display text is located on top of the list, |
|
120 acts as a prompt for the checkbox for marking all items and is valid only in MultiSelection mode. |
|
121 Default value is "Mark All" |
|
122 |
|
123 \sa selectionTitle() |
|
124 */ |
|
125 void HbSelectionDialog::setSelectionTitle(const QString& title) |
|
126 { |
|
127 Q_D(HbSelectionDialog); |
|
128 d->setSelectionTitle(title); |
|
129 } |
|
130 |
|
131 |
99 /*! |
132 /*! |
100 Sets the \a SelectionMode of the list. |
133 Sets the \a SelectionMode of the list. |
101 |
134 |
102 \param mode It can be SingleSelection or MultiSelection. |
135 \param mode It can be NoSelection, SingleSelection or MultiSelection. |
103 |
136 |
104 \sa selectionMode() |
137 \sa selectionMode() |
105 */ |
138 */ |
106 void HbSelectionDialog::setSelectionMode(HbAbstractItemView::SelectionMode mode) |
139 void HbSelectionDialog::setSelectionMode(HbAbstractItemView::SelectionMode mode) |
107 { |
140 { |
160 return d->selectedItems(); |
193 return d->selectedItems(); |
161 } |
194 } |
162 |
195 |
163 /*! |
196 /*! |
164 set the item selected. |
197 set the item selected. |
165 It can select one item if \a Selection mode is \a SingleSelection |
198 It can select one item if \a Selection mode is \a SingleSelection or \a NoSelection |
166 it can select more item if \a SelectionMode is \a MultiSelection. |
199 it can select more item if \a SelectionMode is \a MultiSelection. |
167 |
200 |
168 \param items indices of the items to be selected in SelectionDialog. |
201 \param items indices of the items to be selected in SelectionDialog. |
169 |
202 |
170 \sa selectedItems |
203 \sa selectedItems |