Add GUI to a QT Project with Arduino - c++

So here is my question I have been trying to create a small "software" which would control my arduino card. For this I decide to use qt so I used this tutorial to add arduino to qt :
http://www.lucidarme.me/?p=3287
I am very sorry the page is only in French. I basicly get 3 files config files and includes for my arduino. And a Makefile. The problem I have is that I want to add GUI such as Windows but whenever I add a gui file to my project it says it cannot find the "QMainWindow". However I think the problem is deeper and that it doesn't find any Qt class.
I think this is because I don't have any pro files but I tried adding one and it didn't work. I hope you guys understood my problem I am very new to QT ...
Thank you !

The GUI project is completely unrelated to anything Arduino. The page you linked to shows how to use Qt Creator as an IDE to work on Arduino projects, as a replacement to the Arduino IDE. This has nothing to do with GUIs or Qt, you'd be reusing Qt Creator as a general-purpose IDE that it is.
What you need and want is to create a standard Qt project in Qt Creator and go from there. You can also leverage Qt to "simulate" Arduino code without running real Arduino hardware, see this answer for an example.

Related

No QAudioDeviceInfo::availableDevices on Windows

I'm using Visual Studio 2015 Community to make a Qt-based GUI in C++ which includes a microphone input. I'm testing the microphone part, and am looping through QAudioDeviceInfo::AvailableDevices(QAudio::Mode::AudioInput) (and AudioOutput for that matter) and nothing is coming up. I've checked that my project includes QtMultimedia, and I definitely have audio devices on this computer. I'm stuck with an existing compiled Qt (since this application is plugging into another project), but I've verified that the Qt install has the QtMultimedia and the Windows audio plugins. The Qt version is 5.9.3.
The only thing I can think of is that the project isn't including the right plugin, but I don't know how to change that.
The issue was that I needed to run "windeployqt" on the built executable to get all of the plugins into the right place. I'm curious why it didn't work without that, but that's a VS + Qt plugin problem, not a Qt problem.

Wrong coordinates in a Qt Application

I created a Qt Application with Qt Creator 3.3.1, using Qt embedded 4.8.6 for a Cortex A5.
It runs on a board with Linux embedded and a touchscreen.
The filesystem was created with Buildroot 2015.08.
I'm using a resistive touchscreen calibrated with ts_calibrate.
The Qt Application works, but I often get the wrong coordinates. For example, when I push on a button, sometimes the program takes the coordinates related to another point of the touchscreen, giving the idea that the button pushed doesn't work properly.
My Qt enviroment variable are:
export TSLIB_CALIBFILE='/etc/pointercal'
export TSLIB_CONFFILE='/etc/ts.conf'
export TSLIB_PLUGINDIR='/usr/lib/ts'
export TSLIB_TSDEVICE=`cat /etc/ts.dev 2>/dev/null`
export QWS_DISPLAY=LinuxFB:mmWidth=800:mmHeight=480
export QWS_MOUSE_PROTO=Tslib:/dev/input/event0
If I try to use another Qt Application (for example the Qt demos created with Buildroot) I get the same problem.
Is it a bug of Qt 4.8.6 or something?
Can anyone help me? Thank you
Sounds like playing with your activated filters or their parameters in ts.conf might help.
Since you asked your question, there is tslib 1.2 and (if you need multitouch) tslib 1.3-rc3, both with new and improved filters, see tslib's project page

How to use QtWebview for Google Maps

Basically I want to use it for googlemaps but at the moment I can't even get it to compile a simple web page.
I'm using the latest version of Qt creator but the documentation just seems out of date
i have dragged the widget onto my form and set its url to google.com (just for testing purposes)
and when i hit compile i get loads of unresolved external symbol errors, I don't know what to include to use this I just assumed drag and drop the widget and I'm good to go, however this isn't the case.
Any ideas?
EDIT: For Qt 4.x, this is what you do:
Go into your .pro file and include the right module for QtWebKit.
http://qt-project.org/wiki/QtWebKit
QT += webkit
And here is an example you can find in the welcome pages of Qt Creator if you want more:
http://qt-project.org/doc/qt-4.8/webkit-fancybrowser.html
Good luck; hope that helps. And btw, I just tested it with Google Maps, and it renders fine with Qt 4.8.4 on Win 7.
EDIT: For Qt 5.x+, this is what you do:
QT += webkitwidgets
Like it shows in the .pro file of any of the examples here:
http://qt-project.org/doc/qt-5.0/qtwebkitexamples/webkitwidgets-browser-browser-pro.html
http://qt-project.org/doc/qt-5.0/qtwebkitexamples/qtwebkitexamples-index.html
And you may want to consider also adding the network module in the pro file, too.
Ok so iv seen the QT +=webkit solution all over the place which for the record doesnt work if you have just dragged a dropped a webview into a widget using qt designer.
the solution i finally found that worked was
QT+=webkitwidgets
all working now thought id answer my own question after solving it to help anyone else who might be having the same problem

How to create GUI programs with Code::Blocks

Previously I used Visual Studio for my C++ programmings. But some cost effects I had to change my IDE, so I chose Code::Clocks (12.11). But I can't find a way to develop GUI applications with C::B. Is there any way to develop GUIs with C::B?
Yes, You can develop GUIs with CodeBlocks if you have GTK+ or wxWidget Libraries. You can use one of them at your own choice. CodeBlocks can't use them until you download and install them, So you have to perform some actions to make them usable in CodeBlocks. For GTK+ configuration steps see this and for wxWidget see this.
I create Win32 gui apps all the time with Code::Blocks 20.3 (uses MinGW-W64 project compiler) because I code them using the Win32 api. This is the manual way of doing things, and it works great; the down-side is that you must learn the Win32 api. (its an aspiring challenge, but for an experienced C/C++ programmer and some google skills, its doable)
Many programmers believe that gui apps must be built with a graphical builder (GTK+, wxWidgets, etc) but not true. In fact, in the stock version of the 20.3 Code::Blocks one of the project options is Win32 app. It builds a 'very' minimal cpp file that displays a blank window and starts the message loop... this is a good place to start if you've never seen a gui cpp text file that produces a blank window. You will need to study the Win32 api and learn how to use the message loop, how to add controls (buttons etc) to your project, and how to debug it; its a learning curve, but it is rewarding education. Get the book, "Programming Windows" fifth edition--- make sure its the fifth edition only!
The Microsoft docs are pretty good for learning the Win32 api also, but the book is the best approach. Take a class.
marcus
If you want to start creating GUI programs with 'Code::Blocks' then using a 'Win32' approach looks promising.
I only recently installed 'Code::Blocks 20.03', using the defaults for the install directory, and type of installation( Full ), and was easily able to create a basic 'Win32 GUI project'.
NB: I was using Windows 10, and the basic project doesn't really do anything.
For some Microsoft documentation, see at
https://learn.microsoft.com/en-us/windows/win32/learnwin32/learn-to-program-for-windows
, please note at the bottom left of this page, a 'Download PDF' link.
You could start at page 18 of the pdf, which is where, 'Module 1. Your First Windows Program', starts, page 20 is illuminating.
For information on 'The Message Loop', mentioned in a previous answer, see page 24.
It might be worth bearing in mind 'Reply #3' to the question at
https://forums.codeblocks.org/index.php?topic=19537.0

Eclipse like FilteredTree for Qt?

I'm new to Qt (using Qt SDK with Qt Creator) and in the process of creating a GUI. What I'm looking for is a FilteredTree like the one found in the Preferences of Eclipse. Is there something "ready to use" out there? I've tried all search queries I can think of but no results so far.
In case it matters I'm absolutely willing to update to the newest Qt version.