[Solved] problem with TextFinder tutorial
Hi, all -
I'm brand new to all of this. I'm trying to do the TextFinder tutorial described here:
I'm running on a Mac, by the way. The only change I saw necessary was to change this:
...in the file textfinder.cpp.
So, the program builds OK, but it doesn't open the input file. Nor does it give any error that I can see. Can anyone suggest what I might look at to get this working?
I probably should point out that there were a couple of minor differences between my source files and the ones in the tutorial; probably a version issue.
Thanks for any help.
Are you sure you have the file in the correct position?
Maybe you have build separate from the code (-shared- shadow build).
No, I'm not sure. Wouldn't the application signal some kind of error, though, if the file couldn't be found?
The file is in the same directory as the source code and everything else.
Can you tell me a little more about shared build?
Thanks for the reply.
Sorry i mean shadow build.
My little problem when qtcreator have introduct the shadow build is the correct position of file.
In my case when i build with shadow build, i have a source folder called 'source' and qtcreator create a source-build-desktop with folder debug and release i have to put the file that i use in that folder.
If you able the shadow build you can see the check in the project setting.
Alternative you can simply use a qt "resource":http://doc.qt.nokia.com/4.7/resources.html for a static file.
I am in fact using a resource file; it was generated when I created the project. I just noticed, though, that there was an error in it. Just to be safe, I deleted the project files and started fresh.
Now, though, I notice that when I create the project per the tutorial, it skips a step that is mentioned in the tutorial, namely the Select Required Qt Versions dialog.
Any idea why I might be skipping this, and whether it's important?
If you use a resource file, you have add a file in the resource then you have to use this code
@QFile inputFile(":/input.txt");@ where :/input is the file that you have add to the resource.
Past the code of the resource file.
If you compile you have just select a version, but in the project setting there is the version of qt that you use for building the project.
Ahh...it appears I out-smarted myself on this one. I assumed that the ":/" was part of a DOS file pathname. But, if I infer correctly from your post, it's actually used by Qt itself.
I left it in this time, and the demo now appears to work. Thank you VERY much for your help. Now, I have to go do some more tutorials until I begin to actually understand this stuff...