Subclassed QPlainTextEdit, how can call in other class?
-
I did it like this in RepairDevices constructor:
connect(ui.sn_txt,SIGNAL(textChanged(QString)),this,SLOT(setDirty(QString)));But I get a warning:
QObject::connect: No such signal QPlainTextEdit::textChanged(QString)And it's not working.
What am I doing wrong? -
I did it like this in RepairDevices constructor:
connect(ui.sn_txt,SIGNAL(textChanged(QString)),this,SLOT(setDirty(QString)));But I get a warning:
QObject::connect: No such signal QPlainTextEdit::textChanged(QString)And it's not working.
What am I doing wrong? -
This is the connection in RepairDevices' constructor:
connect(ui.sn_txt,SIGNAL(textChanged(QString)),this,SLOT(setDirty(QString)));
This is the declaration of the function:
public slots: void setDirty(QString txt);
This is the function:
void RepairDevices::setDirty(QString txt) { qDebug() << "text=" << txt; }
-
When I change to textChanged(), it works.
But I don't have the text of the sn_txt.And I see here: void QPlainTextEdit::textChanged()
@Panoss said in Subclassed QPlainTextEdit, how can call in other class?:
textChanged
i dont think it has version where it emits the whole text. lineEdit has.
so you must use QPlainTextEdit::textChanged() and
void RepairDevices::setDirty()
{
qDebug() << "text=" << ui->plaintext->toPlainText();
} -
The reason I subclassed it, was because I wanted the class to connect to RepairDevices 's slot.
(that is, the code: connect blah blah to be in the class)
This is not possible, so it's canceled.
Thank you for your help.