View Full Version : Delete line qtextedit
arturs
18th April 2015, 08:45
Hi
How to find and delete line/block from qtextedit which content for example Char 'A'.
Regards
Artur
Santosh Reddy
22nd April 2015, 11:05
Hope this should help
QTextEdit textEdit;
textEdit.setPlainText(
"How are you today\n"
"I am not A Visible\n"
"I am not a good\n"
"I am A\n"
"I am a\n"
"I am B");
QStringList lines = textEdit.toPlainText().split("\n");
int i = 0;
while(i < lines.size())
{
QString line = lines.at(i);
if(line.contains('A'))
{
lines.removeAt(i);
}
else
{
i++;
}
}
textEdit.setPlainText(lines.join("\n"));
textEdit.show();
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.