Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] How to use QDesktopWidget with QGuiApplication...
I am trying to build an OpenGL application based on this example code here:
I can get the example code to build but now I need a few more things like menus, toolbars, etc.
One of the first things I need is to detect the screen size and place the monitor on the second screen.
Therefore, I was attempting to use QDesktopWidget for this task.
I attempt to initialize the QDesktopWidget instance like so:
@QDesktopWidget* ScreenDetector = QApplication::desktop();@
But since I am using QGuiApplication instead of QApplication I get the following error:
"QWidget: Cannot create a QWidget with QApplication"
Is it possible to use QDesktopWidget and other desktop widgets with QGuiApplication?
Or should I be using another example for what I am trying to do?
Thank you for your time.
Just replace QGuiApplication with QApplication. QApplication inherits from QGuiApplication.
Thanks, that worked!
I have another error message but I will post that in a separate post.
You're welcome !
Since you have your widgets working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)
[quote author="SGaist" date="1410808258"]You're welcome !
Since you have your widgets working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)[/quote]
You got it.