40 |
39 |
41 |
40 |
42 /*! |
41 /*! |
43 @beta |
42 @beta |
44 @hbwidgets |
43 @hbwidgets |
45 |
|
46 \class HbInputDialog |
44 \class HbInputDialog |
47 \brief HbInputDialog creates a modal dialog for the user to get some information in the form of text or numbers. |
45 \brief HbInputDialog is a convenient class for getting user inputs. |
48 |
|
49 Based on the \InputMode user can enter text, int, double or an IP address. InputDialog can have one or two line edit input fields. |
46 Based on the \InputMode user can enter text, int, double or an IP address. InputDialog can have one or two line edit input fields. |
50 |
47 |
51 HbInputDialog by default will have a label to display a descriptive text for the line edit input field and, |
48 \image html inputdialog.png "An Input dialog with prompt text and a user input field." |
52 OK and Cancel buttons. |
49 |
|
50 HbInputDialog by default will have a label to display a descriptive text which gives information on the user input field, |
|
51 an edit field for entering text and,two action buttons. |
53 |
52 |
54 example code example: |
53 example code example: |
55 \code |
54 \code |
56 HbInputDialog *object = new HbInputDialog(parent); |
55 HbInputDialog *object = new HbInputDialog(); |
57 object->show(); |
|
58 \endcode |
56 \endcode |
59 |
57 |
60 Four static convenience API's are provided: getText(), getInteger(), getDouble(), and getIp() |
58 The HbDialog::open( QObject* receiver, const char* member ) method from the HbDialog is used to show the HbInputDialog. |
|
59 |
|
60 The open method can be attached with a SLOT of the format finished(HbAction*) or finished(int). When the open is used with a slot then the slot |
|
61 will be invoked once the user does any action such as accept or reject (The Ok or Cancel press). |
|
62 |
|
63 |
|
64 below is the declaration of the slot. |
|
65 \code |
|
66 public slots : |
|
67 void dialogClosed(int); |
|
68 \endcode |
|
69 |
|
70 below code shows how the open method can be called using this slot. |
|
71 \snipped{ultimatecodesnipped/ultimatecodesnippet.cpp,56} |
|
72 |
|
73 A sample slot definition is shown below |
|
74 \snipped{ultimatecodesnipped/ultimatecodesnippet.cpp,55} |
|
75 |
|
76 In HbInputDialog four static convenience API's are provided: queryText(), queryInteger(), queryDouble(), and queryIp() |
61 static API's can be used to quickly get an input from user. |
77 static API's can be used to quickly get an input from user. |
62 |
78 |
63 \enum HbInputDialog::InputMode |
79 \enum HbInputDialog::InputMode |
64 |
80 |
65 \value \b TextInput When this value is set as Input mode, input dialog accepts text input in its |
81 \value \b TextInput When this value is set as Input mode, Input Dialog accepts text input in its |
66 correspoinding line edit field. |
82 correspoinding line edit field. |
67 |
83 |
68 \value \b IntInput When this value is set as Input mode, input dialog accepts Integer input in its |
84 \value \b IntInput When this value is set as Input mode, Input Dialog accepts Integer input in its |
69 correspoinding line edit field. |
85 correspoinding line edit field. |
70 |
86 |
71 \value \b RealInput When this value is set as Input mode, input dialog accepts double or float input in its |
87 \value \b RealInput When this value is set as Input mode, Input Dialog accepts double or float input in its |
72 correspoinding line edit field. |
88 correspoinding line edit field. |
73 |
89 |
74 \value \b IpInput When this value is set as Input mode, input dialog accepts Ip address as input in its |
90 \value \b IpInput When this value is set as Input mode, Input Dialog accepts Ip address as input in its |
75 correspoinding line edit field. |
91 correspoinding line edit field. |
76 |
92 |
77 */ |
93 */ |
78 |
94 |
79 |
95 |
105 HbInputDialog::~HbInputDialog() |
121 HbInputDialog::~HbInputDialog() |
106 { |
122 { |
107 } |
123 } |
108 |
124 |
109 /*! |
125 /*! |
110 Sets the input mode of the primary(Top/default)line edit in the query widget. |
126 Sets the input mode of the user field. The default InputMode is TextInput. |
111 |
127 The other available modes are IntInput,RealInput and IpInput. |
112 The default InputMode is TextInput |
|
113 |
128 |
114 \param mode. InputMode can be TextMode, IntMode, RealMode and Ip address mode. |
129 \param mode. InputMode can be TextMode, IntMode, RealMode and Ip address mode. |
115 each mode will affect how the line edit filters its input. |
130 each mode will affect how the line edit filters its input. |
116 |
131 |
117 \param row. value 0 or 1 |
132 \param row. This parameter indicates which row of the field.0 (by default) means the |
118 |
133 the first user field and 1 means second user field. |
|
134 |
119 \sa inputMode() |
135 \sa inputMode() |
120 */ |
136 */ |
121 void HbInputDialog::setInputMode(InputMode mode ,int row) |
137 void HbInputDialog::setInputMode(InputMode mode ,int row) |
122 { |
138 { |
123 Q_D(HbInputDialog); |
139 Q_D(HbInputDialog); |
124 d->setInputMode(mode,row); |
140 d->setInputMode(mode,row); |
125 } |
141 } |
126 |
142 |
127 /*! |
143 /*! |
128 Returns input mode for top/default line edit. |
144 Returns input mode of the user field.The default InputMode is TextInput. |
129 |
145 |
130 The default InputMode is TextInput |
146 \param row This parameter indicates which row of the field.0 means the |
131 |
147 the first user field and 1 means second user field. |
132 \param row. value 0 or 1 |
|
133 |
148 |
134 \sa setInputMode() |
149 \sa setInputMode() |
135 */ |
150 */ |
136 HbInputDialog::InputMode HbInputDialog::inputMode(int row) const |
151 HbInputDialog::InputMode HbInputDialog::inputMode(int row) const |
137 { |
152 { |
146 } |
161 } |
147 } |
162 } |
148 } |
163 } |
149 |
164 |
150 /*! |
165 /*! |
151 Sets the prompt \a text for top/default line edit. |
166 Sets the prompt text for the user field. This prompt text text can be very descriptive like username,password etc. |
152 |
167 |
153 \param text. Text for the label which describes the purpose of the corresponding input line edit field. |
168 \param text The promt text string. Maximum number of lines shown is 2. |
154 \param row. value 0 or 1 |
169 \param row This parameter indicates which row of the user field.0 (by default) means the |
|
170 the first user field and 1 means second user field. |
155 |
171 |
156 \sa promtText() |
172 \sa promtText() |
157 */ |
173 */ |
158 void HbInputDialog::setPromptText(const QString &text, int row) |
174 void HbInputDialog::setPromptText(const QString &text, int row) |
159 { |
175 { |
160 Q_D(HbInputDialog); |
176 Q_D(HbInputDialog); |
161 d->setPromptText(text, row); |
177 d->setPromptText(text, row); |
162 } |
178 } |
163 |
179 |
164 /*! |
180 /*! |
165 Returns prompt text for top/default line edit. |
181 Returns descriptive prompt text. |
166 the default is null string. |
182 |
167 \param row. value 0 or 1 |
183 \param row This parameter indicates which row of the field. 0 means the |
|
184 the user field in the first row and 1 means user field in the second row. |
168 |
185 |
169 \sa setPromptText() |
186 \sa setPromptText() |
170 */ |
187 */ |
171 QString HbInputDialog::promptText(int row) const |
188 QString HbInputDialog::promptText(int row) const |
172 { |
189 { |
173 Q_D(const HbInputDialog); |
190 Q_D(const HbInputDialog); |
174 return d->promptText(row); |
191 return d->promptText(row); |
175 } |
192 } |
176 |
193 |
177 /*! |
194 /*! |
178 Sets the top/default line edit value in \a text format. |
195 Sets the value for the user input field.The value should in sync HbInputDialog::InputMode of the field. |
179 |
196 |
180 \param value. user defined value for the default line edit. |
197 \param value The value that should be presented to the user. |
181 \param row. value 0 or 1 |
198 |
|
199 \param row This parameter indicates which row of the user field.0 (by default) means the |
|
200 the first user field and 1 means second user field. |
182 |
201 |
183 \sa value() |
202 \sa value() |
184 */ |
203 */ |
185 void HbInputDialog::setValue(const QVariant &value,int row) |
204 void HbInputDialog::setValue(const QVariant &value,int row) |
186 { |
205 { |
187 Q_D(HbInputDialog); |
206 Q_D(HbInputDialog); |
188 d->setText(value.toString(),row); |
207 d->setText(value.toString(),row); |
189 } |
208 } |
190 |
209 |
191 /*! |
210 /*! |
192 Returns top/default line edit value as QVariant object. |
211 This returns the value of the user field row. The return type is QVariant which can be converted to |
193 |
212 corresponding type based on HbInputDialog::InputMode of the field. |
194 \param row. value 0 or 1 |
213 |
|
214 \param row This parameter indicates which row of the user field.0 (by default) means the |
|
215 the first user field and 1 means second user field |
195 |
216 |
196 \sa setValue() |
217 \sa setValue() |
197 */ |
218 */ |
198 QVariant HbInputDialog::value(int row) const |
219 QVariant HbInputDialog::value(int row) const |
199 { |
220 { |
200 Q_D(const HbInputDialog); |
221 Q_D(const HbInputDialog); |
201 return QVariant(d->text(row)); |
222 return QVariant(d->text(row)); |
202 } |
223 } |
203 |
224 |
204 /*! |
225 /*! |
205 Sets the visibility of bottom line edit and prompt text. |
226 HbInputDialog is capable of showing one or two user input fields. This can be set using this function. |
206 |
227 By default this is false and only first row is visible. |
207 \param visible true or false. |
228 |
|
229 \param visible true or false. If true then two user fields will be visible otherwise one. |
208 |
230 |
209 \sa isAdditionalRowVisible() |
231 \sa isAdditionalRowVisible() |
210 */ |
232 */ |
211 void HbInputDialog::setAdditionalRowVisible(bool visible) |
233 void HbInputDialog::setAdditionalRowVisible(bool visible) |
212 { |
234 { |
213 Q_D(HbInputDialog); |
235 Q_D(HbInputDialog); |
214 d->setAdditionalRowVisible(visible); |
236 d->setAdditionalRowVisible(visible); |
215 } |
237 } |
216 |
238 |
217 /*! |
239 /*! |
218 Returns the visibility of secondary row(bottom line edit and prompt text). |
240 Returns the visibility of second row user input field.The default is false. |
219 the default is false |
241 |
220 \sa setAdditionalRowVisible() |
242 \sa setAdditionalRowVisible() |
221 */ |
243 */ |
222 bool HbInputDialog::isAdditionalRowVisible() |
244 bool HbInputDialog::isAdditionalRowVisible() |
223 { |
245 { |
224 Q_D(HbInputDialog); |
246 Q_D(HbInputDialog); |
225 return d->isAdditionalRowVisible(); |
247 return d->isAdditionalRowVisible(); |
226 } |
248 } |
227 |
249 |
228 /*! |
250 /*! |
229 Validator is used to validate the content and cursor movements. |
251 |
230 |
252 This API allows the user to set any validator to the user input field. |
231 \param validator. Validator uses undo stack to back out invalid changes. Therefore undo |
253 |
|
254 \param validator Validator uses undo stack to back out invalid changes. Therefore undo |
232 is enabled when validator is set. |
255 is enabled when validator is set. |
233 |
256 |
234 \sa HbAbstractEdit::setValidator |
257 \param row This parameter indicates which row of the user field.0 means the |
|
258 the first user field and 1 means second user field |
|
259 |
|
260 \sa HbAbstractEdit::validator |
235 */ |
261 */ |
236 void HbInputDialog::setValidator(HbValidator *validator,int row) |
262 void HbInputDialog::setValidator(HbValidator *validator,int row) |
237 { |
263 { |
238 Q_D(HbInputDialog); |
264 Q_D(HbInputDialog); |
239 if( (row == 0) && (d->mContentWidget->mEdit1) ) { |
265 if( (row == 0) && (d->mContentWidget->mEdit1) ) { |
349 if (d->mContentWidget->mLabel2 && d->mContentWidget->mAdditionalRowVisible) { |
377 if (d->mContentWidget->mLabel2 && d->mContentWidget->mAdditionalRowVisible) { |
350 style()->updatePrimitive(d->mContentWidget->mLabel2, HbStyle::P_InputDialog_additionaltext, &option); |
378 style()->updatePrimitive(d->mContentWidget->mLabel2, HbStyle::P_InputDialog_additionaltext, &option); |
351 } |
379 } |
352 } |
380 } |
353 |
381 |
354 /*! |
382 void HbInputDialog::done(int code) |
355 Returns the echoMode of line edit. returns -1 if row is more than 2. |
383 { |
356 |
384 Q_D(HbInputDialog); |
357 \param row. A value 0 or 1 |
385 if(code==Accepted) { |
|
386 QString text; |
|
387 if(d->mContentWidget && d->mContentWidget->mEdit1) { |
|
388 text = d->mContentWidget->mEdit1->text(); |
|
389 } |
|
390 switch(d->mPrimaryMode) { |
|
391 case HbInputDialog::TextInput: |
|
392 case HbInputDialog::IpInput: { |
|
393 emit textValueSelected(text); |
|
394 break; |
|
395 } |
|
396 case HbInputDialog::IntInput: { |
|
397 emit intValueSelected(text.toInt(0,10)); |
|
398 break; |
|
399 } |
|
400 case HbInputDialog::RealInput: { |
|
401 emit doubleValueSelected(text.toDouble()); |
|
402 break; |
|
403 } |
|
404 default: |
|
405 break; |
|
406 } |
|
407 } |
|
408 HbDialog::done(code); |
|
409 } |
|
410 |
|
411 /*! |
|
412 Returns the echoMode of the user input field.It returns HbLineEdit::EchoMode. |
|
413 |
|
414 \param row This parameter indicates which row of the user field.0 means the |
|
415 the first user input field and 1 means second user input field |
358 |
416 |
359 \sa setEchoMode() |
417 \sa setEchoMode() |
360 */ |
418 */ |
361 HbLineEdit::EchoMode HbInputDialog::echoMode(int row) const |
419 HbLineEdit::EchoMode HbInputDialog::echoMode(int row) const |
362 { |
420 { |
368 } |
426 } |
369 return HbLineEdit::EchoMode(-1);// |
427 return HbLineEdit::EchoMode(-1);// |
370 } |
428 } |
371 |
429 |
372 /*! |
430 /*! |
373 Static convenience function for creating an input dialog to get a string from the user. |
431 \deprecated HbInputDialog::getText(const QString&,QObject*,const char*,const QString&,QGraphicsScene*,QGraphicsItem*) |
374 \a label is the text which is shown to the user (it should |
432 is deprecated. |
375 say what should be entered). \a text is the default text which is |
433 |
376 placed in the line edit. If \a ok is non-null \e *\a ok will be |
434 This is a static convenience function for creating an Input Dialog and to get a string data from the the user. The Application can use this |
377 set to true if the user pressed \gui OK and to false if the user pressed |
435 function in order to get any text data from user like username,search data etc. This API allows a slot to be passed as a param. This slot will |
378 \gui Cancel. The dialog's parent is \a parent. The dialog will be |
436 be invoked when the user does the action like OK press or CANCEL press. |
379 modal. |
437 |
380 |
438 HbInputDialog::getText(iTitle,this,SLOT(dialogClosed(HbAction*)),iText); iTitle is the prompt text.dialogClosed will be invoked when the user does the action. |
381 This function return data has to be queried in the finished(HbAction*) slot. |
439 Please refer the class documentation to know how to handle the slot. |
382 |
440 |
|
441 \param label The prompt text which gives information on user input field. |
|
442 \param receiver The instance where the slot is declared. |
|
443 \param member The slot which has dialogClosed(HbAction*) signature. |
|
444 \param text The default text that should be presented to the user. |
|
445 \param scene The scene parameter. |
|
446 \param parent The parent item for the dialog. |
|
447 |
383 \sa getInteger(), getDouble(), getIp() |
448 \sa getInteger(), getDouble(), getIp() |
384 */ |
449 */ |
385 void HbInputDialog::getText(const QString &label, |
450 void HbInputDialog::getText(const QString &label, |
386 QObject *receiver, |
451 QObject *receiver, |
387 const char* member, |
452 const char* member, |
430 dlg->setValue(QString::number(value)); |
488 dlg->setValue(QString::number(value)); |
431 dlg->setAttribute(Qt::WA_DeleteOnClose); |
489 dlg->setAttribute(Qt::WA_DeleteOnClose); |
432 dlg->open(receiver,member); |
490 dlg->open(receiver,member); |
433 } |
491 } |
434 /*! |
492 /*! |
435 Static convenience function to get a floating point number from |
493 \deprecated HbInputDialog::getDouble(const QString&,QObject*,const char*,double,QGraphicsScene*,QGraphicsItem*) |
436 the user.\a label is the text which is shown to the user |
494 is deprecated. |
437 (it should say what should be entered). \a value is the default |
495 |
438 floating point number that the line edit will be set to. |
496 \sa queryInteger(), queryDouble(), queryIp() |
439 |
|
440 If \a ok is non-null, *\a ok will be set to true if the user |
|
441 pressed \gui OK and to false if the user pressed \gui Cancel. The |
|
442 dialog's parent is \a parent. The dialog will be modal. |
|
443 |
|
444 This function return data has to be queried in the finished(HbAction*) slot. |
|
445 |
|
446 \sa getText(), getInteger(), getIp() |
|
447 */ |
497 */ |
448 void HbInputDialog::getDouble(const QString &label, |
498 void HbInputDialog::getDouble(const QString &label, |
449 QObject *receiver, |
499 QObject *receiver, |
450 const char *member, |
500 const char *member, |
451 double value, |
501 double value, |
460 dlg->setInputMode(RealInput); |
510 dlg->setInputMode(RealInput); |
461 dlg->setValue(QString::number(value)); |
511 dlg->setValue(QString::number(value)); |
462 dlg->open(receiver,member); |
512 dlg->open(receiver,member); |
463 } |
513 } |
464 |
514 |
465 |
515 /*! |
466 /*! |
516 \deprecated HbInputDialog::getIp(const QString &,QObject*,const char*,const QString&,QGraphicsScene*,QGraphicsItem*) |
467 Static convenience function to get an ip address from |
517 is deprecated. |
468 the user.\a label is the text which is shown to the user |
518 |
469 (it should say what should be entered). \a address is the default |
519 \sa queryInteger(), queryDouble(), queryIp() |
470 QHostAddress that the line edit will be set to. |
520 */ |
471 |
521 |
472 If \a ok is non-null, *\a ok will be set to true if the user |
|
473 pressed \gui OK and to false if the user pressed \gui Cancel. The |
|
474 dialog's parent is \a parent. The dialog will be modal. |
|
475 |
|
476 This function return data has to be queried in the finished(HbAction*) slot. |
|
477 |
|
478 \sa getText(), getInteger(), getDouble() |
|
479 */ |
|
480 void HbInputDialog::getIp(const QString &label, |
522 void HbInputDialog::getIp(const QString &label, |
481 QObject *receiver, |
523 QObject *receiver, |
482 const char *member, |
524 const char *member, |
483 const QString &ipaddress, |
525 const QString &ipaddress, |
484 QGraphicsScene *scene, |
526 QGraphicsScene *scene, |
487 HbInputDialog *dlg = new HbInputDialog(parent); |
529 HbInputDialog *dlg = new HbInputDialog(parent); |
488 if(scene && !parent) { |
530 if(scene && !parent) { |
489 scene->addItem(dlg); |
531 scene->addItem(dlg); |
490 } |
532 } |
491 dlg->setPromptText(label); |
533 dlg->setPromptText(label); |
492 dlg->setValue(ipaddress); |
534 dlg->setValue(ipaddress); |
493 dlg->setInputMode(IpInput); |
535 dlg->setInputMode(IpInput); |
494 dlg->open(receiver,member); |
536 dlg->open(receiver,member); |
495 } |
537 } |
496 |
538 |
|
539 /*! |
|
540 This is a static convenience function for creating an Input Dialog and to get a string data from the the user. The Application can use this |
|
541 function in order to get any text data from user like username,search data etc. This API allows a slot to be passed as a param. This slot will |
|
542 be invoked when the user does the action like OK press or CANCEL press. |
|
543 |
|
544 HbInputDialog::queryText(iTitle,this,SLOT(dialogClosed(int)),iText); iTitle is the prompt text.dialogClosed will be invoked when the user does the action. |
|
545 Please refer the class documentation to know how to handle the slot. |
|
546 |
|
547 \param promptText The prompt text which gives information on user input field. |
|
548 \param receiver The instance where the slot is declared. |
|
549 \param member The slot which has dialogClosed(HbAction*) or dialogClosed(int) signature. |
|
550 \param defaultText The default text that should be presented to the user. |
|
551 \param scene The scene parameter. |
|
552 \param parent The parent item for the dialog. |
|
553 |
|
554 \sa queryInteger(), queryDouble(), queryIp() |
|
555 */ |
|
556 void HbInputDialog::queryText(const QString &promptText, |
|
557 QObject *receiver, |
|
558 const char* member, |
|
559 const QString &defaultText, |
|
560 QGraphicsScene *scene, |
|
561 QGraphicsItem *parent) |
|
562 { |
|
563 HbInputDialog *dlg = new HbInputDialog(parent); |
|
564 if (scene && !parent) { |
|
565 scene->addItem(dlg); |
|
566 } |
|
567 dlg->setPromptText(promptText); |
|
568 dlg->setInputMode(TextInput); |
|
569 dlg->setValue(defaultText); |
|
570 dlg->setAttribute(Qt::WA_DeleteOnClose); |
|
571 dlg->open(receiver,member); |
|
572 } |
|
573 |
|
574 |
|
575 /*! |
|
576 This is a static convenience function for creating an Input Dialog and to get an integer data from the the user. The Application can use this |
|
577 function in order to get any integer data from user like year , any number etc. This API allows a slot to be passed as a param. This slot will |
|
578 be invoked when the user does the action like OK press or CANCEL press. |
|
579 |
|
580 HbInputDialog::queryInt(iTitle,this,SLOT(dialogClosed(int)),iText); iTitle is the prompt text.dialogClosed will be invoked when the user does the action. |
|
581 Please refer the class documentation to know how to handle the slot. |
|
582 |
|
583 \param promptText The prompt text which gives information on user input field. |
|
584 \param receiver The instance where the slot is declared. |
|
585 \param member The slot which has dialogClosed(HbAction*) or dialogClosed(int) signature. |
|
586 \param defaultInt The default value that should be presented to the user. |
|
587 \param scene The scene parameter. |
|
588 \param parent The parent widget for the dialog. |
|
589 |
|
590 \sa queryText(), queryDouble(), queryIp() |
|
591 */ |
|
592 void HbInputDialog::queryInt(const QString &promptText, |
|
593 QObject *receiver, |
|
594 const char *member, |
|
595 int defaultInt, |
|
596 QGraphicsScene *scene, |
|
597 QGraphicsItem *parent) |
|
598 { |
|
599 HbInputDialog *dlg = new HbInputDialog(parent); |
|
600 if(scene && !parent) { |
|
601 scene->addItem(dlg); |
|
602 } |
|
603 dlg->setPromptText(promptText); |
|
604 dlg->setInputMode(IntInput); |
|
605 dlg->setValue(QString::number(defaultInt)); |
|
606 dlg->setAttribute(Qt::WA_DeleteOnClose); |
|
607 dlg->open(receiver,member); |
|
608 } |
|
609 /*! |
|
610 This is a static convenience function for creating an Input Dialog and to get a double data from the the user. The Application can use this |
|
611 function in order to get any double data from user. This API allows a slot to be passed as a param. This slot will |
|
612 be invoked when the user does the action like OK press or CANCEL press. |
|
613 |
|
614 HbInputDialog::queryDouble(iTitle,this,SLOT(dialogClosed(int)),iText); iTitle is the prompt text.dialogClosed will be invoked when the user does the action. |
|
615 Please refer the class documentation to know how to handle the slot. |
|
616 |
|
617 \param promptText The prompt text which gives information on user input field. |
|
618 \param receiver the instance where the slot is declared. |
|
619 \param member the slot which has dialogClosed(HbAction*) or dialogClosed(int) signature. |
|
620 \param defaultDouble the default value that should be presented to the user. |
|
621 \param scene the scene parameter. |
|
622 \param parent the parent widget for the dialog. |
|
623 |
|
624 \sa queryText(), queryInteger(), queryIp() |
|
625 */ |
|
626 void HbInputDialog::queryDouble(const QString &promptText, |
|
627 QObject *receiver, |
|
628 const char *member, |
|
629 double defaultDouble, |
|
630 QGraphicsScene *scene, |
|
631 QGraphicsItem *parent) |
|
632 { |
|
633 HbInputDialog *dlg = new HbInputDialog(parent); |
|
634 if(scene && !parent) { |
|
635 scene->addItem(dlg); |
|
636 } |
|
637 dlg->setPromptText(promptText); |
|
638 dlg->setInputMode(RealInput); |
|
639 dlg->setValue(QString::number(defaultDouble)); |
|
640 dlg->open(receiver,member); |
|
641 } |
|
642 |
|
643 |
|
644 /*! |
|
645 This is a static convenience function for creating an Input Dialog and to get an IP information from the the user. This API allows a slot to be passed as a param. This slot will |
|
646 be invoked when the user does the action like OK press or CANCEL press. |
|
647 |
|
648 HbInputDialog::queryIp(iTitle,this,SLOT(dialogClosed(int)),iText); iTitle is the prompt text.dialogClosed will be invoked when the user does the action. |
|
649 Please refer the class documentation to know how to handle the slot. |
|
650 |
|
651 \param promptText The prompt text which gives information on user input field. |
|
652 \param receiver the instance where the slot is declared. |
|
653 \param member the slot which has dialogClosed(HbAction*) or dialogClosed(int) signature. |
|
654 \param defaultIp the default value that should be presented to the user. |
|
655 \param scene the scene parameter. |
|
656 \param parent the parent widget for the dialog. |
|
657 |
|
658 \sa queryText(), queryInteger(), queryDouble() |
|
659 */ |
|
660 |
|
661 void HbInputDialog::queryIp(const QString &promptText, |
|
662 QObject *receiver, |
|
663 const char *member, |
|
664 const QString &defaultIp, |
|
665 QGraphicsScene *scene, |
|
666 QGraphicsItem *parent) |
|
667 { |
|
668 HbInputDialog *dlg = new HbInputDialog(parent); |
|
669 if(scene && !parent) { |
|
670 scene->addItem(dlg); |
|
671 } |
|
672 dlg->setPromptText(promptText); |
|
673 dlg->setValue(defaultIp); |
|
674 dlg->setInputMode(IpInput); |
|
675 dlg->open(receiver,member); |
|
676 } |
497 #include "moc_hbinputdialog.cpp" |
677 #include "moc_hbinputdialog.cpp" |
|
678 |