Hi,

Originally Posted by
Vash5556
void VashTextEditor::find()
{
FindDialog findDialog(this);
if (!findDialog.exec())
return;
const QString searchString
= findDialog.
getSearchString();
bool test = documentEdit->find(searchString);
if (test)
{
QMessageBox::information(this, tr
("Vash Text Editor"), tr
("Expression found."));
}
else
{
QMessageBox::information(this, tr
("Vash Text Editor"), tr
("Expression not found."));
}
}
void VashTextEditor::find()
{
FindDialog findDialog(this);
if (!findDialog.exec())
return;
const QString searchString = findDialog.getSearchString();
bool test = documentEdit->find(searchString);
if (test)
{
QMessageBox::information(this, tr("Vash Text Editor"), tr("Expression found."));
}
else
{
QMessageBox::information(this, tr("Vash Text Editor"), tr("Expression not found."));
}
}
To copy to clipboard, switch view to plain text mode
Seems fine, but to debug what does following code produce (at the end of your function)?
qWarning() << searchString;
qWarning() << documentEdit->toPlainText();
qWarning() << documentEdit->textCursor()->position();
qWarning() << searchString;
qWarning() << documentEdit->toPlainText();
qWarning() << documentEdit->textCursor()->position();
To copy to clipboard, switch view to plain text mode
void FindDialog::toggleFindButton()
{
QString currentText
= findLineEdit
->text
();
if (!currentText.isEmpty())
{
findButton->setEnabled(true);
}
else
{
findButton->setEnabled(false);
}
}
void FindDialog::toggleFindButton()
{
QString currentText = findLineEdit->text();
if (!currentText.isEmpty())
{
findButton->setEnabled(true);
}
else
{
findButton->setEnabled(false);
}
}
To copy to clipboard, switch view to plain text mode
findButton->setEnabled(!findLineEdit->text().isEmpty());
findButton->setEnabled(!findLineEdit->text().isEmpty());
To copy to clipboard, switch view to plain text mode
does the same.
P.s.: Expected is a normal string, no regular expression.
Bookmarks