src/gui/dialogs/qinputdialog.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    93     Q_OBJECT
    93     Q_OBJECT
    94 
    94 
    95 public:
    95 public:
    96     QInputDialogSpinBox(QWidget *parent)
    96     QInputDialogSpinBox(QWidget *parent)
    97         : QSpinBox(parent) {
    97         : QSpinBox(parent) {
    98         connect(lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(notifyTextChanged()));
    98         connect(lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(notifyTextChanged()));
    99         connect(this, SIGNAL(editingFinished()), this, SLOT(notifyTextChanged()));
    99         connect(this, SIGNAL(editingFinished()), this, SLOT(notifyTextChanged()));
   100     }
   100     }
   101 
   101 
   102 signals:
   102 signals:
   103     void textChanged(bool);
   103     void textChanged(bool);
   128     Q_OBJECT
   128     Q_OBJECT
   129 
   129 
   130 public:
   130 public:
   131     QInputDialogDoubleSpinBox(QWidget *parent = 0)
   131     QInputDialogDoubleSpinBox(QWidget *parent = 0)
   132         : QDoubleSpinBox(parent) {
   132         : QDoubleSpinBox(parent) {
   133         connect(lineEdit(), SIGNAL(textChanged(const QString&)), this, SLOT(notifyTextChanged()));
   133         connect(lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(notifyTextChanged()));
   134         connect(this, SIGNAL(editingFinished()), this, SLOT(notifyTextChanged()));
   134         connect(this, SIGNAL(editingFinished()), this, SLOT(notifyTextChanged()));
   135     }
   135     }
   136 
   136 
   137 signals:
   137 signals:
   138     void textChanged(bool);
   138     void textChanged(bool);
   243 {
   243 {
   244     Q_Q(QInputDialog);
   244     Q_Q(QInputDialog);
   245     if (!lineEdit) {
   245     if (!lineEdit) {
   246         lineEdit = new QLineEdit(q);
   246         lineEdit = new QLineEdit(q);
   247         lineEdit->hide();
   247         lineEdit->hide();
   248         QObject::connect(lineEdit, SIGNAL(textChanged(const QString&)),
   248         QObject::connect(lineEdit, SIGNAL(textChanged(QString)),
   249                          q, SLOT(_q_textChanged(const QString&)));
   249                          q, SLOT(_q_textChanged(QString)));
   250     }
   250     }
   251 }
   251 }
   252 
   252 
   253 void QInputDialogPrivate::ensureComboBox()
   253 void QInputDialogPrivate::ensureComboBox()
   254 {
   254 {
   255     Q_Q(QInputDialog);
   255     Q_Q(QInputDialog);
   256     if (!comboBox) {
   256     if (!comboBox) {
   257         comboBox = new QComboBox(q);
   257         comboBox = new QComboBox(q);
   258         comboBox->hide();
   258         comboBox->hide();
   259         QObject::connect(comboBox, SIGNAL(editTextChanged(const QString&)),
   259         QObject::connect(comboBox, SIGNAL(editTextChanged(QString)),
   260                          q, SLOT(_q_textChanged(const QString&)));
   260                          q, SLOT(_q_textChanged(QString)));
   261         QObject::connect(comboBox, SIGNAL(currentIndexChanged(const QString&)),
   261         QObject::connect(comboBox, SIGNAL(currentIndexChanged(QString)),
   262                          q, SLOT(_q_textChanged(const QString&)));
   262                          q, SLOT(_q_textChanged(QString)));
   263     }
   263     }
   264 }
   264 }
   265 
   265 
   266 void QInputDialogPrivate::ensureListView()
   266 void QInputDialogPrivate::ensureListView()
   267 {
   267 {
   274         listView->setEditTriggers(QAbstractItemView::NoEditTriggers);
   274         listView->setEditTriggers(QAbstractItemView::NoEditTriggers);
   275         listView->setSelectionMode(QAbstractItemView::SingleSelection);
   275         listView->setSelectionMode(QAbstractItemView::SingleSelection);
   276         listView->setModel(comboBox->model());
   276         listView->setModel(comboBox->model());
   277         listView->setCurrentIndex(QModelIndex()); // ###
   277         listView->setCurrentIndex(QModelIndex()); // ###
   278         QObject::connect(listView->selectionModel(),
   278         QObject::connect(listView->selectionModel(),
   279                          SIGNAL(currentRowChanged(const QModelIndex&, const QModelIndex&)),
   279                          SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
   280                          q, SLOT(_q_currentRowChanged(const QModelIndex&, const QModelIndex&)));
   280                          q, SLOT(_q_currentRowChanged(QModelIndex,QModelIndex)));
   281     }
   281     }
   282 }
   282 }
   283 
   283 
   284 void QInputDialogPrivate::ensureIntSpinBox()
   284 void QInputDialogPrivate::ensureIntSpinBox()
   285 {
   285 {