I'm not going to open another thread cos the topic is quite like before, if I should do it please tell me, next time i'll do it.
I saw here that QLineEdit can emit textChanged ( const QString & text ) signal so i made a connection to hook it in ths way:
connect(ui.
lineEditExpression,
SIGNAL(QLineEdit::textChanged(const QString &)),
this,
SLOT(emptyLine
(const QString &)));
connect(ui.lineEditExpression, SIGNAL(QLineEdit::textChanged(const QString &)), this, SLOT(emptyLine(const QString &)));
To copy to clipboard, switch view to plain text mode
where lineEditExpression is a pointer to QLineEdit, but when application start i see a warning like this:
Object::connect: (sender name: 'lineEditExpression')
Object::connect: (receiver name: 'regExpClass')
Object::connect: No such signal QLineEdit::QLineEdit::textChanged(QString)
Object::connect: (sender name: 'lineEditExpression')
Object::connect: (receiver name: 'regExpClass')
To copy to clipboard, switch view to plain text mode
to complite i post all my class code:
#include "QRegExp"
#include "QRegExpValidator"
#include <QLineEdit>
#include "regexp.h"
{
ui.setupUi(this);
connect(ui.pushButtonClose, SIGNAL(clicked()), this, SLOT(close()));
connect(ui.pushButtonValidate, SIGNAL(clicked()), this, SLOT(validator()));
connect(ui.
lineEditExpression,
SIGNAL(QLineEdit::textChanged(const QString &)),
this,
SLOT(emptyLine
(const QString &)));
}
regExp::~regExp()
{
}
void regExp::validator()
{
stringExpression = ui.lineEditExpression->text();
stringValidator = ui.lineEditRE->text();
int result = re.indexIn(stringExpression);
ui.
labelOut->setText
(QString::number(result,
10));
}
void regExp
::emptyLine(const QString &text
) {
ui.labelOut->setText("changed");
}
#include "QRegExp"
#include "QRegExpValidator"
#include <QLineEdit>
#include "regexp.h"
regExp::regExp(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
connect(ui.pushButtonClose, SIGNAL(clicked()), this, SLOT(close()));
connect(ui.pushButtonValidate, SIGNAL(clicked()), this, SLOT(validator()));
connect(ui.lineEditExpression, SIGNAL(QLineEdit::textChanged(const QString &)), this, SLOT(emptyLine(const QString &)));
}
regExp::~regExp()
{
}
void regExp::validator()
{
stringExpression = ui.lineEditExpression->text();
stringValidator = ui.lineEditRE->text();
QRegExp re(stringValidator);
int result = re.indexIn(stringExpression);
ui.labelOut->setText(QString::number(result, 10));
}
void regExp::emptyLine(const QString &text)
{
ui.labelOut->setText("changed");
}
To copy to clipboard, switch view to plain text mode
Bookmarks