summaryrefslogtreecommitdiffabout
path: root/qtcompat/qinputdialog.cpp
Side-by-side diff
Diffstat (limited to 'qtcompat/qinputdialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--qtcompat/qinputdialog.cpp2
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 )
/*!
Returns the input type of the dialog.
\sa setType()
*/
QInputDialog::Type QInputDialog::type() const
{
return d->type;
}
/*!
Destructor.
*/
QInputDialog::~QInputDialog()
{
delete d;
}
/*!
Static convenience function to get a textual input from the user. \a caption is the text
which is displayed in the title bar of the dialog. \a label is the text which
is shown to the user (it should mention to the user what he/she should input), \a text
the default text which will be initially set to the line edit, \a ok a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, \a parent the parent widget of the dialog and \a name
the name of it. The dialogs pops up modally!
This method returns the text which has been entered in the line edit.
You will use this static method like this:
\code
bool ok = FALSE;
QString text = QInputDialog::getText( tr( "Please enter your name" ), QString::null, &ok, this );
if ( ok && !text.isEmpty() )
;// user entered something and pressed ok
else
;// user entered nothing or pressed cancel
\endcode
*/
QString QInputDialog::getText( const QString &caption, const QString &label, const QString &text,
bool *ok, QWidget *parent, const char *name )
{
return getText( caption, label, QLineEdit::Normal, text, ok, parent, name );
}
/*!
Like above, but accepts an a \a mode which the line edit will use to display text.
\sa getText()
*/
QString QInputDialog::getText( const QString &caption, const QString &label, QLineEdit::EchoMode mode,
const QString &text, bool *ok, QWidget *parent, const char *name )
{
QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit );
dlg->setCaption( caption );
dlg->lineEdit()->setText( text );
dlg->lineEdit()->setEchoMode( mode );
if ( !text.isEmpty() )
dlg->lineEdit()->selectAll();
-
+ dlg->setMinimumWidth ( 230 );
bool ok_ = FALSE;
QString result;
ok_ = dlg->exec() == QDialog::Accepted;
if ( ok )
*ok = ok_;
if ( ok_ )
result = dlg->lineEdit()->text();
delete dlg;
return result;
}
/*!
Static convenience function to get an integral input from the user. \a caption is the text
which is displayed in the title bar of the dialog. \a label is the text which
is shown to the user (it should mention to the user what he/she should input), \a num
the default number which will be initially set to the spinbox, \a from and \a to the
range in which the entered number has to be, \a step the step in which the number can
be increased/decreased by the spinbox, \a ok a pointer to
a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the
user pressed cancel, \a parent the parent widget of the dialog and \a name
the name of it. The dialogs pops up modally!
This method returns the number which has been entered by the user.
You will use this static method like this:
\code
bool ok = FALSE;
int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this );
if ( ok )
;// user entered something and pressed ok
else
;// user pressed cancel
\endcode
*/
int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step,
bool *ok, QWidget *parent, const char *name )
{
QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox );
dlg->setCaption( caption );
dlg->spinBox()->setRange( from, to );
dlg->spinBox()->setSteps( step, 0 );
dlg->spinBox()->setValue( num );
bool ok_ = FALSE;
int result;
ok_ = dlg->exec() == QDialog::Accepted;
if ( ok )
*ok = ok_;
result = dlg->spinBox()->value();
delete dlg;
return result;
}
/*!
Static convenience function to get a decimal input from the user. \a caption is the text
which is displayed in the title bar of the dialog. \a label is the text which
is shown to the user (it should mention to the user what he/she should input), \a num
the default decimal number which will be initially set to the line edit, \a from and \a to the
range in which the entered number has to be, \a decimals the number of decimal which
the number may have, \a ok a pointer to