![is there word count in text edit is there word count in text edit](https://support.content.office.net/en-us/media/d3ddf944-dee8-4043-bdb3-af3dee438599.jpg)
,!? using a regular expression into a list QString line = in.readLine() // split the line into single words at. It can be simplified using QString::split() with a regular expression, and consecutive seperators can be filtered out by removing empty strings from the in(&file) Your word counting code works in general, but be aware that it will treat consecutive seperators as words (eg. Ui you want to analyze the file line by line you should stick to readLine(), as readAll() reads the whole file. By the way - I got the lines to print and the word count by using a in.ReadAll() function. Any help at this point is greatly appreciated. I know it i a c++ thing at this point and I m a newbie at c++ and Qt. What my program is doing at this moment is displaying all the lines in the file and then printing the count. What I need to do is to get the word count to display after it prints each line to the text window. Ui ->textEdit->append(QString::number(numWords+12)) If (!file.open(QIODevice::ReadOnly | QIODevice::Text))
#IS THERE WORD COUNT IN TEXT EDIT HOW TO#
I can read the lines in the file and display them, but I broke the word count.Ĭan some one help me understand how to count the number of words in a line the Qt way? It is a lot of fun learning Qt with c++!! I am starting (or at least trying) to do things the Qt way! Where am I going wrong? can someone please help me clear my confusion? void QTextEdit::append(const QString& keep getting an error : /home/ironmantis7x/Projects/Qt_code/bible2/bible2-build-desktop/./bible2/bible2.cpp:42: error: no matching function for call to ‘QTextEdit::append(std::string&)’ Void bible2::on_textBrowser_histor圜hanged()
![is there word count in text edit is there word count in text edit](https://images.squarespace-cdn.com/content/v1/547a3a14e4b0d64f97a64275/1429726059400-WVFQKD9OM577OML9WMJF/character+count+screenshot.jpg)
Unsigned int revnumWords = 0 getline(in, text) Ĭout textEdit->append(QString::number(numWords+12)) Ĭout textEdit->append(QString::number(numWords+10)) Ĭout textEdit->append("In this text file, there exists " + (QString::number(numWords)) + " words") here is my "bible2.h"Ĭonnect (ui->pushButton, SIGNAL(clicked()), this, SLOT(on_textEdit_textChanged())) I am trying to get a variable (string variable) to display in a text edit window in Qt.