[Qt-interest] Error when building demo application TextFinder
George Panagopoulos
qt at eyeway.gr
Tue Nov 15 17:18:34 CET 2011
???? 15/11/2011 6:03 ??, ?/? Jean Richard Lima ??????:
> Can you post here line 9 or the complete code in Pastbin? (Because
> otherwise I'll have to see the code to make all)
>
> Hugs.
>
> Jean Richard Lima
> Consultor de Gestão e TIC
> Software House de Projetos Específicos
>
>
> 2011/11/15 George Panagopoulos <qt at eyeway.gr <mailto:qt at eyeway.gr>>
>
> Hi list,
>
> I am new to Qt and I am trying to learn from the example
> applications included in the tutorial.
>
> The demo app I was testing is the TextFinder app described in the
> Qt creator tutorial here:
> http://doc.qt.nokia.com/qtcreator-2.3/creator-writing-program.html
>
> Problem is that when I try to build and run the application I get
> an error "..\TextFinder\textfinder.cpp:9: error: expected
> primary-expression before ')' token"
>
> After some search I found that this is caused by this line of
> code: QMetaObject::connectSlotsByName(TextFinder);
> wich is suposed to connect the pushbutton signal to the
> corresponding slot.
>
> Although it is not clear in the tutorial where this line of code
> should be placed, I placed it inside the constructor and after
> this line of code: ui->setupUi(this);
>
> Could you please tell me what is wrong and why so I learn
> something out of this?
>
> Thank you in advance.
>
> George
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com <mailto:Qt-interest at qt.nokia.com>
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
Here is the code from my textfinder.cpp
#include"textfinder.h"
#include "ui_textfinder.h"
TextFinder::TextFinder(QWidget *parent) :
QWidget(parent),
ui(new Ui::TextFinder)
{
ui->setupUi(this);
}
TextFinder::~TextFinder()
{
delete ui;
}
void TextFinder::on_findButton_clicked()
{
QString searchString = ui->lineEdit->text();
ui->textEdit->find(searchString,QTextDocument::FindWholeWords);
}
void TextFinder::loadTextFile()
{
QFile inputFile(":/input.txt");
inputFile.open(QIODevice::ReadOnly);
QTextStream in(&inputFile);
QString line = in.readAll();
inputFile.close();
ui->textEdit->setPlainText(line);
QTextCursor cursor = ui->textEdit->textCursor();
cursor.movePosition(QTextCursor::Start,QTextCursor::MoveAnchor,1);
}
Thanks
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111115/cc7b5e6c/attachment.html
More information about the Qt-interest-old
mailing list