-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 | |||
@@ -22,32 +22,34 @@ | |||
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | //Edited Lutz Rogowski 2004-12-13 | ||
39 | |||
38 | #include "qinputdialog.h" | 40 | #include "qinputdialog.h" |
39 | 41 | ||
40 | #include <qlayout.h> | 42 | #include <qlayout.h> |
41 | #include <qlabel.h> | 43 | #include <qlabel.h> |
42 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
43 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
44 | #include <qspinbox.h> | 46 | #include <qspinbox.h> |
45 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
46 | #include <qwidgetstack.h> | 48 | #include <qwidgetstack.h> |
47 | #include <qvalidator.h> | 49 | #include <qvalidator.h> |
48 | #include <qapplication.h> | 50 | #include <qapplication.h> |
49 | 51 | ||
50 | class QInputDialogPrivate | 52 | class QInputDialogPrivate |
51 | { | 53 | { |
52 | public: | 54 | public: |
53 | friend class QInputDialog; | 55 | friend class QInputDialog; |
@@ -440,32 +442,37 @@ double QInputDialog::getDouble( const QString &caption, const QString &label, do | |||
440 | QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list, | 442 | QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list, |
441 | int current, bool editable, | 443 | int current, bool editable, |
442 | bool *ok, QWidget *parent, const char *name ) | 444 | bool *ok, QWidget *parent, const char *name ) |
443 | { | 445 | { |
444 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, editable ? EditableComboBox : ComboBox ); | 446 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, editable ? EditableComboBox : ComboBox ); |
445 | dlg->setCaption( caption ); | 447 | dlg->setCaption( caption ); |
446 | if ( editable ) { | 448 | if ( editable ) { |
447 | dlg->editableComboBox()->insertStringList( list ); | 449 | dlg->editableComboBox()->insertStringList( list ); |
448 | dlg->editableComboBox()->setCurrentItem( current ); | 450 | dlg->editableComboBox()->setCurrentItem( current ); |
449 | } else { | 451 | } else { |
450 | dlg->comboBox()->insertStringList( list ); | 452 | dlg->comboBox()->insertStringList( list ); |
451 | dlg->comboBox()->setCurrentItem( current ); | 453 | dlg->comboBox()->setCurrentItem( current ); |
452 | } | 454 | } |
453 | 455 | ||
454 | bool ok_ = FALSE; | 456 | bool ok_ = FALSE; |
455 | QString result; | 457 | QString result; |
458 | int fixWid = 320; | ||
459 | if ( QApplication::desktop()->width() <= 240 ) { | ||
460 | fixWid = 230; | ||
461 | } | ||
462 | dlg->setFixedWidth( fixWid); | ||
456 | ok_ = dlg->exec() == QDialog::Accepted; | 463 | ok_ = dlg->exec() == QDialog::Accepted; |
457 | if ( ok ) | 464 | if ( ok ) |
458 | *ok = ok_; | 465 | *ok = ok_; |
459 | if ( editable ) | 466 | if ( editable ) |
460 | result = dlg->editableComboBox()->currentText(); | 467 | result = dlg->editableComboBox()->currentText(); |
461 | else | 468 | else |
462 | result = dlg->comboBox()->currentText(); | 469 | result = dlg->comboBox()->currentText(); |
463 | 470 | ||
464 | delete dlg; | 471 | delete dlg; |
465 | return result; | 472 | return result; |
466 | } | 473 | } |
467 | 474 | ||
468 | /*! | 475 | /*! |
469 | \internal | 476 | \internal |
470 | */ | 477 | */ |
471 | 478 | ||