-rw-r--r-- | qtcompat/qinputdialog.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/qtcompat/qinputdialog.cpp b/qtcompat/qinputdialog.cpp index 64c581e..ce46118 100644 --- a/qtcompat/qinputdialog.cpp +++ b/qtcompat/qinputdialog.cpp | |||
@@ -247,129 +247,129 @@ void QInputDialog::setType( Type t ) | |||
247 | /*! | 247 | /*! |
248 | Returns the input type of the dialog. | 248 | Returns the input type of the dialog. |
249 | 249 | ||
250 | \sa setType() | 250 | \sa setType() |
251 | */ | 251 | */ |
252 | 252 | ||
253 | QInputDialog::Type QInputDialog::type() const | 253 | QInputDialog::Type QInputDialog::type() const |
254 | { | 254 | { |
255 | return d->type; | 255 | return d->type; |
256 | } | 256 | } |
257 | 257 | ||
258 | /*! | 258 | /*! |
259 | Destructor. | 259 | Destructor. |
260 | */ | 260 | */ |
261 | 261 | ||
262 | QInputDialog::~QInputDialog() | 262 | QInputDialog::~QInputDialog() |
263 | { | 263 | { |
264 | delete d; | 264 | delete d; |
265 | } | 265 | } |
266 | 266 | ||
267 | /*! | 267 | /*! |
268 | Static convenience function to get a textual input from the user. \a caption is the text | 268 | Static convenience function to get a textual input from the user. \a caption is the text |
269 | which is displayed in the title bar of the dialog. \a label is the text which | 269 | which is displayed in the title bar of the dialog. \a label is the text which |
270 | is shown to the user (it should mention to the user what he/she should input), \a text | 270 | is shown to the user (it should mention to the user what he/she should input), \a text |
271 | the default text which will be initially set to the line edit, \a ok a pointer to | 271 | the default text which will be initially set to the line edit, \a ok a pointer to |
272 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the | 272 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the |
273 | user pressed cancel, \a parent the parent widget of the dialog and \a name | 273 | user pressed cancel, \a parent the parent widget of the dialog and \a name |
274 | the name of it. The dialogs pops up modally! | 274 | the name of it. The dialogs pops up modally! |
275 | 275 | ||
276 | This method returns the text which has been entered in the line edit. | 276 | This method returns the text which has been entered in the line edit. |
277 | 277 | ||
278 | You will use this static method like this: | 278 | You will use this static method like this: |
279 | 279 | ||
280 | \code | 280 | \code |
281 | bool ok = FALSE; | 281 | bool ok = FALSE; |
282 | QString text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this ); | 282 | QString text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this ); |
283 | if ( ok && !text.isEmpty() ) | 283 | if ( ok && !text.isEmpty() ) |
284 | ;// user entered something and pressed ok | 284 | ;// user entered something and pressed ok |
285 | else | 285 | else |
286 | ;// user entered nothing or pressed cancel | 286 | ;// user entered nothing or pressed cancel |
287 | \endcode | 287 | \endcode |
288 | */ | 288 | */ |
289 | 289 | ||
290 | QString QInputDialog::getText( const QString &caption, const QString &label, const QString &text, | 290 | QString QInputDialog::getText( const QString &caption, const QString &label, const QString &text, |
291 | bool *ok, QWidget *parent, const char *name ) | 291 | bool *ok, QWidget *parent, const char *name ) |
292 | { | 292 | { |
293 | return getText( caption, label, QLineEdit::Normal, text, ok, parent, name ); | 293 | return getText( caption, label, QLineEdit::Normal, text, ok, parent, name ); |
294 | } | 294 | } |
295 | 295 | ||
296 | /*! | 296 | /*! |
297 | Like above, but accepts an a \a mode which the line edit will use to display text. | 297 | Like above, but accepts an a \a mode which the line edit will use to display text. |
298 | 298 | ||
299 | \sa getText() | 299 | \sa getText() |
300 | */ | 300 | */ |
301 | 301 | ||
302 | QString QInputDialog::getText( const QString &caption, const QString &label, QLineEdit::EchoMode mode, | 302 | QString QInputDialog::getText( const QString &caption, const QString &label, QLineEdit::EchoMode mode, |
303 | const QString &text, bool *ok, QWidget *parent, const char *name ) | 303 | const QString &text, bool *ok, QWidget *parent, const char *name ) |
304 | { | 304 | { |
305 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit ); | 305 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit ); |
306 | dlg->setCaption( caption ); | 306 | dlg->setCaption( caption ); |
307 | dlg->lineEdit()->setText( text ); | 307 | dlg->lineEdit()->setText( text ); |
308 | dlg->lineEdit()->setEchoMode( mode ); | 308 | dlg->lineEdit()->setEchoMode( mode ); |
309 | if ( !text.isEmpty() ) | 309 | if ( !text.isEmpty() ) |
310 | dlg->lineEdit()->selectAll(); | 310 | dlg->lineEdit()->selectAll(); |
311 | 311 | dlg->setMinimumWidth ( 230 ); | |
312 | bool ok_ = FALSE; | 312 | bool ok_ = FALSE; |
313 | QString result; | 313 | QString result; |
314 | ok_ = dlg->exec() == QDialog::Accepted; | 314 | ok_ = dlg->exec() == QDialog::Accepted; |
315 | if ( ok ) | 315 | if ( ok ) |
316 | *ok = ok_; | 316 | *ok = ok_; |
317 | if ( ok_ ) | 317 | if ( ok_ ) |
318 | result = dlg->lineEdit()->text(); | 318 | result = dlg->lineEdit()->text(); |
319 | 319 | ||
320 | delete dlg; | 320 | delete dlg; |
321 | return result; | 321 | return result; |
322 | } | 322 | } |
323 | 323 | ||
324 | /*! | 324 | /*! |
325 | Static convenience function to get an integral input from the user. \a caption is the text | 325 | Static convenience function to get an integral input from the user. \a caption is the text |
326 | which is displayed in the title bar of the dialog. \a label is the text which | 326 | which is displayed in the title bar of the dialog. \a label is the text which |
327 | is shown to the user (it should mention to the user what he/she should input), \a num | 327 | is shown to the user (it should mention to the user what he/she should input), \a num |
328 | the default number which will be initially set to the spinbox, \a from and \a to the | 328 | the default number which will be initially set to the spinbox, \a from and \a to the |
329 | range in which the entered number has to be, \a step the step in which the number can | 329 | range in which the entered number has to be, \a step the step in which the number can |
330 | be increased/decreased by the spinbox, \a ok a pointer to | 330 | be increased/decreased by the spinbox, \a ok a pointer to |
331 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the | 331 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the |
332 | user pressed cancel, \a parent the parent widget of the dialog and \a name | 332 | user pressed cancel, \a parent the parent widget of the dialog and \a name |
333 | the name of it. The dialogs pops up modally! | 333 | the name of it. The dialogs pops up modally! |
334 | 334 | ||
335 | This method returns the number which has been entered by the user. | 335 | This method returns the number which has been entered by the user. |
336 | 336 | ||
337 | You will use this static method like this: | 337 | You will use this static method like this: |
338 | 338 | ||
339 | \code | 339 | \code |
340 | bool ok = FALSE; | 340 | bool ok = FALSE; |
341 | int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this ); | 341 | int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this ); |
342 | if ( ok ) | 342 | if ( ok ) |
343 | ;// user entered something and pressed ok | 343 | ;// user entered something and pressed ok |
344 | else | 344 | else |
345 | ;// user pressed cancel | 345 | ;// user pressed cancel |
346 | \endcode | 346 | \endcode |
347 | */ | 347 | */ |
348 | 348 | ||
349 | int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step, | 349 | int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step, |
350 | bool *ok, QWidget *parent, const char *name ) | 350 | bool *ok, QWidget *parent, const char *name ) |
351 | { | 351 | { |
352 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox ); | 352 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox ); |
353 | dlg->setCaption( caption ); | 353 | dlg->setCaption( caption ); |
354 | dlg->spinBox()->setRange( from, to ); | 354 | dlg->spinBox()->setRange( from, to ); |
355 | dlg->spinBox()->setSteps( step, 0 ); | 355 | dlg->spinBox()->setSteps( step, 0 ); |
356 | dlg->spinBox()->setValue( num ); | 356 | dlg->spinBox()->setValue( num ); |
357 | 357 | ||
358 | bool ok_ = FALSE; | 358 | bool ok_ = FALSE; |
359 | int result; | 359 | int result; |
360 | ok_ = dlg->exec() == QDialog::Accepted; | 360 | ok_ = dlg->exec() == QDialog::Accepted; |
361 | if ( ok ) | 361 | if ( ok ) |
362 | *ok = ok_; | 362 | *ok = ok_; |
363 | result = dlg->spinBox()->value(); | 363 | result = dlg->spinBox()->value(); |
364 | 364 | ||
365 | delete dlg; | 365 | delete dlg; |
366 | return result; | 366 | return result; |
367 | } | 367 | } |
368 | 368 | ||
369 | /*! | 369 | /*! |
370 | Static convenience function to get a decimal input from the user. \a caption is the text | 370 | Static convenience function to get a decimal input from the user. \a caption is the text |
371 | which is displayed in the title bar of the dialog. \a label is the text which | 371 | which is displayed in the title bar of the dialog. \a label is the text which |
372 | is shown to the user (it should mention to the user what he/she should input), \a num | 372 | is shown to the user (it should mention to the user what he/she should input), \a num |
373 | the default decimal number which will be initially set to the line edit, \a from and \a to the | 373 | the default decimal number which will be initially set to the line edit, \a from and \a to the |
374 | range in which the entered number has to be, \a decimals the number of decimal which | 374 | range in which the entered number has to be, \a decimals the number of decimal which |
375 | the number may have, \a ok a pointer to | 375 | the number may have, \a ok a pointer to |