[Qt-interest] Error when building demo application TextFinder
Jean Richard Lima
jean at jeanrl.com.br
Wed Nov 16 00:55:17 CET 2011
Hi George!
The only thing I could see wrong was not found includes the (QFile and
QTextStream), but I'm attaching the project tested to see if you was just
what was wrong.
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>
> Στις 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>
>
>> 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
>> 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
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111115/a8d78f60/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: textfind.zip
Type: application/zip
Size: 4708 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20111115/a8d78f60/attachment.zip
More information about the Qt-interest-old
mailing list