-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 @@ -14,48 +14,50 @@ ** 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; }; @@ -432,48 +434,53 @@ double QInputDialog::getDouble( const QString &caption, const QString &label, do 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 ); |