C++ (Qt)void QLineEdit::textEdited ( const QString & text ) [signal]
C++ (Qt)bool EntryWindow::eventFilter(QObject *target, QEvent *event){ QString objName = target->objectName(); if(objName == "TestEdit") { if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event); if((keyEvent->modifiers() & Qt::ControlModifier) || (keyEvent->modifiers() & Qt::AltModifier)) return true; QKeyEvent *upperKeyEvent = new QKeyEvent(QEvent::KeyPress, keyEvent->nativeVirtualKey(), Qt::NoModifier, QChar(keyEvent->nativeVirtualKey())); qDebug() << upperKeyEvent->text(); QApplication::sendEvent(target, upperKeyEvent); return true;//QWidget::eventFilter(target, &upperKeyEvent); } } return QWidget::eventFilter(target, event);}
C++ (Qt)UpperCaseValidator::UpperCaseValidator(QObject *parent) : QRegExpValidator(QRegExp(...), parent) // regexp{} QValidator::State UpperCaseValidator::validate(QString &input, int &pos) const{ input = input.toUpper(); return QRegExpValidator::validate(input, pos);} ...ui->line->setValidator(new UpperCaseValidator(ui->line));