Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.3.2, 5.4.1
Description
Setting an inputmask on a lineedit will cause textEdited to be emitted.
This example demonstrates it.
#include <QDebug> class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0) : QMainWindow(parent) { setCentralWidget(edit = new QLineEdit(this)); connect(edit, SIGNAL(textEdited(QString)), this, SLOT(onTextEdited())); flipTimer.start(2000, this); } void timerEvent(QTimerEvent *e) { if (e->timerId() == timer.timerId()) { edit->setStyleSheet(QString()); timer.stop(); } else if (e->timerId() == flipTimer.timerId()) { edit->setInputMask(edit->inputMask().isEmpty() ? "000.000.000.000;_" : 0); } else { QMainWindow::timerEvent(e); } } public slots: void onTextEdited() { edit->setStyleSheet("background: red"); timer.start(1000, this); } private: QBasicTimer timer, flipTimer; QLineEdit *edit; }; #include "main.moc" int main(int argc, char **argv) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); }