PDA

View Full Version : Display some lines in a QTextEdit



dd44
11th November 2012, 17:43
Hi,

I have a QTextEdit in read only mode where information is displayed in continuous.
For example:
User 1: message sent
User 2: message received
User 3: message sent
User 2: message received
User 2: message sent
...

I have a QComboBox with the items:
all
user 1
user 2
user 3

I would like when I select an item in the QComboBox, display messages on my user

First of all, I count the number of rows in my QTextEdit:


int = number_row text_edit-> document () -> blockcount ();

Then I browse the rows with a for loop:


for (int i = 0; i <number_row; i + +)
{

}

However, I can not retrieve rows of the user 1 in my textedit if the selected item in the QComboBox is User 1 for example.

I tried with QTextCursor but it is difficult.

If anyone knows ...