Using Qt without the GUI
Qt can be used without the GUI. To create a window to show a OpenGL window without QWindow
, you will need to change your .pro
file to not include the gui modules, and then tell it to include the console.
QT -= gui # Only the core module is used.
CONFIG += console
How do I create a simple Qt console application in C++?
While you are debugging from Qt Creator, you may need to go to the Project > Run and tell it to Run in Terminal
, otherwise it might only exist in the application output area.
http://qt-project.org/doc/qt-5.1/qmake/qmake-project-files.html#declaring-qt-libraries
You will probably need to find some other windowing framework to display your opengl goodness. Depending on what examples you look at, sometimes they use glut, or opencv.
I'm not sure how closely tied the opengl libs are to the QWindow and the other QtGUI or QtWidgets internals. You may need to get opengl from another library if they aren't loading after you remove the Qt GUI.
LIBS += -lopengl #or some other things to use the library from somewhere else
Hope that helps.