Get Linecount of QPlainTextEdit
-
Hello,
I use a QPlainTextEdit as a console window.
Not I want to get the number of the last line. I use this method actually:int Console::getLines( void ) { return this->toPlainText().split( "\n" ).size(); }
This methode doesn´t wort well, because it returns a wrong value when a line is wrapped, because the wrapped line doesn´t contain a carriage return.
Does anybody knows a better solution to count the lines? I doesn´t want any solution which works with the current cursor position, because I want to move the cursor in the console window.Thank you for help
-
Hello,
I use a QPlainTextEdit as a console window.
Not I want to get the number of the last line. I use this method actually:int Console::getLines( void ) { return this->toPlainText().split( "\n" ).size(); }
This methode doesn´t wort well, because it returns a wrong value when a line is wrapped, because the wrapped line doesn´t contain a carriage return.
Does anybody knows a better solution to count the lines? I doesn´t want any solution which works with the current cursor position, because I want to move the cursor in the console window.Thank you for help