-1

I'm trying to setup a program which will count how many lines are in a QTextEdit and run a for loop for the amount of lines have been counted. How could I go about doing this?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
John
  • 11
  • 1
  • 2

1 Answers1

1
ui->plainTextEdit->document()->blockCount()

QTextDocument *QPlainTextEdit::document() const

Returns a pointer to the underlying document.

blockCount : const int

Returns the number of text blocks in the document.

The value of this property is undefined in documents with tables or frames.

By default, if defined, this property contains a value of 1.

http://doc.qt.io/qt-5/qplaintextedit.html#document

Rick Pat
  • 789
  • 5
  • 14