How to work with OpenGL and QT? - c++

I'm Working on a small project and i need to work with OpenGL + QT
I'm Newbie in both of them. So i need a good tutorial that illustrates how to work with them each other not individually
is it better to work OpenGL on QT Creator or use QT Visual Studio Plug-in?

You'll be using QGLWidget a lot! Here you go:
http://doc.qt.io/qt-5/examples-widgets-opengl.html
Of all those, maybe this is the best one to start: Hello GL Example. If you prefer using Qt Quick instead of Qt Widgets, check these posts:
Integrating custom OpenGL rendering with Qt Quick via QQuickFramebufferObject
Scene Graph - OpenGL Under QML
If you want a higher-level 3D API than OpenGL, as o Qt 5.7 Qt 3D became stable.
As for the IDE I suggest using Qt Creator. It works out of the box on Windows and the syntax highlighting and autocomplete are comparable to Visual Studio.

You have several different options for using OpenGL in Qt. It has changed a lot over the years. For an introduction that should cover all the basic info you need to start look at this post. The old style Qt OpenGL classes and functions were called QGLxx but are now called QOpenGLxx and have been moved to the QtGUI module to start with.
Many of the simple OpenGL examples with Qt (including the QOpenGLWindow example shipped with Qt) use the old style of OpenGL that shouldn't be used any longer. Here is a tutorial that has updated the QOpenGLWindow example to modern OpenGL (3+). It is the simplest, most up to date example I have come across.
I second Qt Creator, especially for learning. It has much better integration with the Qt help files than Visual Studio does. If you are considering switching between IDEs I would also recommend building with CMake. CMake is very similar to the built in qmake of Qt Creator but it can work just as good with Visual Studio or other IDEs. I have been running some examples for learning purposes in both Visual Studio and Qt Creator with CMake. Here is a simple CMake example with Qt. For my purposes I still use the Visual Studio compiler when working in Qt Creator though.

There're some examples of how to use Open GL with QT in the SDK. You can open these examples in QT Creator if you want. To answer the second question, I find QT Creator much faster and more pleasant to use than Visual Studio but YMMV.

Related

Can't get QT to work in Visual Studio 2019 and what is the best place to learn QT?

So I do know C++ fairly well, I have used it and C for the past year in college. I'm trying to make an application with a GUI that needs a simple input box and easily customizable windows. The main focus of the project however is a lot of backend processing, I just need a GUI for the user. Is there a place where I can just learn the quick basics of QT? Also for some reason I can't get QT to work on Visual Studio 2019.
I get this error:
When I go to input the version, it doesn't actually save when I click OK.
In Manutention Tool you should download these Qt components marked as MSVC or UWP:
A MinGW build of Qt will probably work only with CLion and Qt Creator
And don't download the latest Qt, because VS doesn't work well with them.

Alternative to VCL on C++Builder

So I'm working at a company and they've been using VCL for GUI development since forever. I'm rather newbie at creating GUI for Windows, but I dislike the options and limitations of the VCL. So I started looking around for other alternatives, are there something better out there?
I've read a lot about WCF but it's Visual Studio only. I also found about QT, but I'm not sure how would I pair C++Builder and the QT Designer software. Is there a package available?
Or if there is a better solution for Windows GUI development with C++Builder - we're using CodeGear's C++Builder 2007 - could you recommend it?
Thanks!
You can use Qt with Builder in conjunction with qmake or cmake(both tools are for project files generation). Well, you can use it with Builder without those generators but then you will have to write all MOC rules yourself and it is a tiresome job.
So my suggestion is to use Qt instead of VCL, especially relatively new Qt feature - Qt Quick which allows you to write UI in declarative fashion
wxWidgets (http://www.wxwidgets.org/) works with C++ Builder, but i am interested to know why you are stuck with C++ Builder? time to move on buddy, I would suggest to move toward QT and use its own QT Creator, Or go for .Net if you prefer.

Which C++ GUI library should I use

I'm developing a segmentation tool (for research purpose, not for commercial use) and I was wondering which graphical user interface should I use as there are many.
I'm looking for a relatively simple interface which allows me to do as follows on the same window:
*Input variables that will be used by the algorithm
*Browse a folder and select images
*Call functions by clicking on a button
*Display an image that will evolve while the algorithm is running
I'm coding in c++ with visual studio 2010 and I'm using additional libraries such as OpenCV, so the GUI library must be compilable and usable on console project on VS2010.
So far I've tried Qt, FLTK, GTK+ but Qt as compatible issues on x64 architectures, FLTK is lacking documentation and I'm not sure it answers to my needs and GTK+ wasn't working.
Thank you very much for any input and help you can give me.
Keep it simple.
If working with C++ on Windows with a "non-express" version of Visual-Studio, just use MFC.
The framework is mature and there are tons of reference, examples and samples on the web (codeproject, codeguru, MSDN, ... )
Have you tried OpenCV's own highgui?
http://opencv.willowgarage.com/documentation/python/highgui__high-level_gui_and_media_i_o.html
"While OpenCV was designed for use in full-scale applications and can
be used within functionally rich UI frameworks (such as Qt, WinForms
or Cocoa) or without any UI at all, sometimes there is a need to try
some functionality quickly and visualize the results. This is what the
HighGUI module has been designed for."
Also see: OpenCV and creating GUIs

Creating GUIs for application

This is a question I've been wondering about for a long time.
How do you create an Interface for your program ?
It seems to much of a pain to position form controls and buttons using just code.
I'm looking for something similar to Visual Basic where you can drag and drop controls onto the window. But, I want to do this for applications written in C++.
Can It be done with compilers like MinGW on Eclipse ?
If you don't want to go the Qt route you can use ResEdit which is freeware. It will produce Win32 friendly .rc files that can be built with the MinGW resource compiler and used in Win32 applications.
There are some C++ Win32 wrapper libraries available though I'm not aware of any that are nearly as mature as Qt. I believe WinxGui is a port of WTL (or at least claims to be compatible with WTL) for GCC. It doesn't look like there has been much activity on the project site for a few years however.
What you're searching for is called Qt, both Eclipse and MinGW friendly.
Check out this nice article.
Qt toolkit is written in C++. So you can use it to develop GUI. It also comes with Qt Designer and Qt Creator IDE and tools.
Qt Reference Documentation
Qt Designer Manual
Qt Creator IDE and tools
And you can use MinGW to compile the code. You don't need to download MInGW separately. When installing Qt toolkik, it asks if you want to download MInGW also, just say yes to it. It will then download the correct version of MInGW itself.
The 1.7 GB download you look at is probably the full Qt SDK. This is not just Qt and documentation, but also includes the Qt Creator IDE with the Qt Designer "Form builder", the MinGW compiler, debugger, examples, demos, and some other stuff. There's also an "online installer" that allows you to select the packages you want before downloading everything. That's probably what I'd use if I were starting from scratch on Windows.

Codeblocks and Qt -- how to work with them?

I am new to codeblocks and Qt. I would like to create some nice interfaces with buttons, lists, combo box and so on using Qt. Can someone help me, give me some links from where I can start my journey? I didn't find anywhere how to include qt designer in codeblocks in order to work with it.
Any help is appreciated.
P.S I am working in Ubuntu. I did install code::blocks 10.05 . I also have QT Designer, Creator, LInguist and Assistent.
When you have Qt Creator, you don't need anything else unless you have any specific preference for Code::Blocks or any other IDEs.
Qt Creator has an integrated debugging interface too (somewhat similar to Visual Studio).
Here is the Qt Creator manual and here you can find details on How to manage projects using Qt Creator.
If you already have all the Qt tools (Creator, Designer, etc.) then why not just use Qt Creator?
It is a wonderful little IDE and is perfect for Qt developing. I actually prefer using it on Ubuntu (on Windows I use the VS Add-In for VS 2010).
The only thing that takes getting used to is adding dependencies which you must directly edit the .pro file for. See http://doc.qt.io/qt-5/qmake-project-files.html