author | zautrix <zautrix> | 2004-12-13 12:35:00 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-12-13 12:35:00 (UTC) |
commit | 7ac6c21e832b7d16bd0888d0b66252b6e152005a (patch) (side-by-side diff) | |
tree | c7610e0e25020f19af82ac6257c2debab2638316 /qtcompat | |
parent | 17b25691f0332e648dd1d800e89ccf4e1da8955d (diff) | |
download | kdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.zip kdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.tar.gz kdepimpi-7ac6c21e832b7d16bd0888d0b66252b6e152005a.tar.bz2 |
many bugfixes
-rw-r--r-- | qtcompat/qinputdialog.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/qtcompat/qinputdialog.cpp b/qtcompat/qinputdialog.cpp index 770b281..64c581e 100644 --- a/qtcompat/qinputdialog.cpp +++ b/qtcompat/qinputdialog.cpp @@ -6,64 +6,66 @@ ** Created : 991212 ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of the dialogs module of the Qt GUI Toolkit. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file ** LICENSE.QPL included in the packaging of this file. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition ** licenses may use this file in accordance with the Qt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for ** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/qpl/ for QPL licensing information. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ +//Edited Lutz Rogowski 2004-12-13 + #include "qinputdialog.h" #include <qlayout.h> #include <qlabel.h> #include <qlineedit.h> #include <qpushbutton.h> #include <qspinbox.h> #include <qcombobox.h> #include <qwidgetstack.h> #include <qvalidator.h> #include <qapplication.h> class QInputDialogPrivate { public: friend class QInputDialog; QLineEdit *lineEdit; QSpinBox *spinBox; QComboBox *comboBox, *editComboBox; QPushButton *ok; QWidgetStack *stack; QInputDialog::Type type; }; /*! \class QInputDialog qinputdialog.h \brief A convenience dialog to get a simple input from the user \ingroup dialogs The QInputDialog is a simple dialog which can be used if you need a simple input from the user. This can be text, a number or an item from a list. Also a label has to be set to tell the user @@ -424,64 +426,69 @@ double QInputDialog::getDouble( const QString &caption, const QString &label, do text of the combobox. You will use this static method like this: \code QStringList lst; lst << "First" << "Second" << "Third" << "Fourth" << "Fifth"; bool ok = FALSE; QString res = QInputDialog::getItem( tr( "Please select an item" ), lst, 1, TRUE, &ok, this ); if ( ok ) ;// user selected an item and pressed ok else ;// user pressed cancel \endcode */ QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list, int current, bool editable, bool *ok, QWidget *parent, const char *name ) { QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, editable ? EditableComboBox : ComboBox ); dlg->setCaption( caption ); if ( editable ) { dlg->editableComboBox()->insertStringList( list ); dlg->editableComboBox()->setCurrentItem( current ); } else { dlg->comboBox()->insertStringList( list ); dlg->comboBox()->setCurrentItem( current ); } bool ok_ = FALSE; QString result; + int fixWid = 320; + if ( QApplication::desktop()->width() <= 240 ) { + fixWid = 230; + } + dlg->setFixedWidth( fixWid); ok_ = dlg->exec() == QDialog::Accepted; if ( ok ) *ok = ok_; if ( editable ) result = dlg->editableComboBox()->currentText(); else result = dlg->comboBox()->currentText(); delete dlg; return result; } /*! \internal */ void QInputDialog::textChanged( const QString &s ) { bool on; if ( d->lineEdit->validator() ) { QString str = d->lineEdit->text(); int index = d->lineEdit->cursorPosition(); on = ( d->lineEdit->validator()->validate(str, index) == QValidator::Acceptable ); } else { on = !s.isEmpty(); } d->ok->setEnabled( on ); } /*! \internal |