I am currently working on a project for school, and I am supposed to program some functions. I'm currently working in a QT application and I have to count words from an Input Widget and give the number of counted words out in another widget.
void MainWindow::countWords(){
int wordCount = ui -> input ->toPlainText().split(QRegExp("(\\s|\\n|\\r)+")
, QString::SkipEmptyParts).count();
ui->output->clear();
ui->output->addItem(QString("Words: "+wordCount));
that's what I currently have(I looked it up in another question on this website) but it doesn't really work. If I type something and press the button to count the words, I get no number of words