Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt: QDesktopWidget file not found

Tags:

c++

qt

qmake

I'm trying to use the QDesktopWidget class, just to resize a window. It appears to be the main class to get the geometry of a user's screen, but Qt cannot find it.

I tried adding QT += widgets in my .pro file, followed by running qmake, but unfortunately this did not work.

like image 828
symanoz Avatar asked Sep 03 '25 06:09

symanoz


1 Answers

From the Qt documentation (emphasis mine):

QDesktopWidget was already deprecated in Qt 5, and has been removed in Qt 6, together with QApplication::desktop().

QScreen provides equivalent functionality to query for information about available screens, screen that form a virtual desktop, and screen geometries.

like image 132
Yun Avatar answered Sep 04 '25 20:09

Yun