I'm trying to build my first Qt user interface using QtSerialPort. I'm having issues trying to understand how to integrate the library as explained in "QtSerialPort":http://qt-project.org/wiki/QtSerialPort into my project, but for the moment I'm just trying to run the terminal example (by itself) that comes with the download. I also found this post "QtSerialPort Lib":http://www.qtcentre.org/threads/49716-Adding-QtSerialPort-as-a-library with some good information in it, but I just can't get it going or understand it correctly.
What I've done so far is:
- Downloaded the package as explained in the QtSerialPort wiki, I saved the uncompressed folder into C:\myQt\qtplayground-qtserialport.
- Next I opened Qt Creator and opened the Qt project file serialport.pro located in the C:\myQt\qtplayground-qtserialport directory.
- Successfully built serialport.pro and all sub-projects. Every example project compiles and runs just fine if I run them from serialport.pro, if I try to open any of the example projects independently then I run into problems.
- Two folders (debug and release) have been created on the C:\myQt directory, they are serialport-build-desktop-Qt_4_8_1_for_Desktop_-MinGW__Qt_SDK__Debug and serialport-build-desktop-Qt_4_8_1_for_Desktop-_MinGW__Qt_SDK__Release.
Now here is the part I get stuck with or maybe I'm missing a step or doing something wrong.
for example, I opened the terminal example which is in C:\myQt\qtplayground-qtserialport\examples\terminal.pro, but I get compile errors.
I'm frustrated at this point and can't find good or better instructions (simpler or idiot proof...) that can get me going. My Idea is to be able to create my project, which I already started, and saved in C:\myQt\serialCommTest and be able to compile it and run it. Not sure if I'm making myself clear, but hope someone can give me a hand. I've used the serial port in C# in the past and don't remember being this difficult for me to set it up.
Win7 64 bit
Qt Creator 2.4.1
Qt 4.8.1 for Desktop MinGW (Qt SDK)
What kind errors you got?
I have same tools version and OS as yours, and QtSerialPort lib and example projects works fine.
To open examples directly (or create custom user Qt project) it is necessary to have the previously installed QtSerialPort library. On Wiki is described process of installation of library after building.
bq. cd serialport-build-release // install release build
make install (or nmake install)
cd serialport-build-debug // install debug build
make install (or nmake install)
Note, at using MinGW compiler, instead of make need write mingw32-make.
PS: I.e after installation, you should appear new *.dll serialport libraries and headers into Qt \bin \lib and \include directories. Please check it after installation.
Yes thanks i got it working last night like 10 minutes after i posted this thread. What my problem was running make instead of mingw32-make. Ive edited the wiki to reflect this. Now my question is about documentation, is there a wiki or something with all the classes in qtserialport? Ive got my arduino sending data now to a small qt app that i slowly built from the examples,but having api doc will benice. I have the documentaion for qserialdevice but its different.
Documentation need generate independently.
Just cd to /qtserialport/doc/ and modify file serialport.qdoccof, instead
bq. indexes = $QT5DOC/doc/html/qt.index
need write path to qt.index file, example:
bq. indexes = < path to index > /qt.index
where qt.index can be take from Qt sources from /doc/html directory.
And finally need from console make:
bq. $doc serialport.qdocconf
Ok here is what I did and couldn't get it working.
1.Opened the serialport.qdocconf with Qt Creator and made below changes:
@#indexes = $QT5DOC/doc/html/qt.index
indexes = C:/QtSDK/readme/qt-sdk.index@
2.Opened the Qt 4.8.1 for Desktop (MingGW) command promtp and try to make
but I get an error when I run the make command. I run mingw32-make serialport.qdocconf
and get this error:
mingw32-make: Nothing to be done for 'serialport.qdocconf'.
I got it now, thanks.
I found your other post "SerialOortDoc Gen":http://www.qtcentre.org/threads/49964-Way-to-check-for-input-data-from-serial-port-without-polling-in-main
I had to run qdoc3 command instead. I got a bunch of errors during the build
bq. I had to run qdoc3 command instead.
Yes, it needs to be used.
bq. indexes = C:/QtSDK/readme/qt-sdk.index
bq. I got a bunch of errors during the build
This qt-sdk.index is not that which is necessary.
I to you clearly told what to take qt.index it is necessary from Qt source codes from a directory /doc/html.
I.e. you should, for example, download like "qt-everywhere-opensource-src-4.8.0.tar.gz",
unpack archive and take /doc/html/qt.index
Size of qt.index is ~13.9MB
It works I get the html files with the documentation.
How do I add it to Qt Creator help file? there is no .qch file.
I don't know. Please try search solution in Google :)
UPD: I found the decision. It is very simple:
First, need build documentation as html form (as write above), and to be convinced that into /html directory was generated a SerialPort.qhp file.
Next, need in console write this:
bq. qhelpgenerator html/SerialPort.qhp
where qhelpgenerator it is standard Qt tools from /bin directory
Make sure that into /html directory was generated a SerialPort.qch file.
Run QtCreator->Options->Help->Add and select SerialPort.qch and click "Apply" buton.
It is all...
PS: I'm try add this how to to Wiki.
Very good, that works nicely. Yeah it will be a good idea to have all this stuff in the wiki.
Thanks for all your help.