Q: My problem is that I don't know which function I need to use....
I am not entirely sure what makes you think this would require a different method call than for your other `textEdit2. You have at least two ways to achieve this depending on your need.
The first variant would be to simply use the same method call for textEdit1
as the for textEdit2
, namely:
if (ui->textEdit1->toPlainText() == ui->textEdit2->toPlainText())
Note that I swapped the order as I think it reads better and it is more comprehensive that way. It may be just my personal style, so pardon me.
If you would like to do case insensitive comparison, then you could also write the following using the static compare method of the QString
class.
if (!QString::compare(ui->textEdit1->toPlainText(), ui->textEdit2->toPlainText(), Qt::CaseInsensitive))
The first solution would be too limited to do a case insensitive comparison, so pick your solution based on your exact desire.