fix get_resolution.py to use QScreen
QDesktopWidget is deprecated in Qt5 and removed in Qt6
This commit is contained in:
parent
4b1a8fe6b4
commit
f21dfd9d95
@ -1,13 +1,16 @@
|
|||||||
from .. import mkQApp
|
from .. import mkQApp
|
||||||
|
from ..Qt import QtGui
|
||||||
|
|
||||||
def test_screenInformation():
|
def test_screenInformation():
|
||||||
|
# a qApp is still needed, otherwise screen is None
|
||||||
qApp = mkQApp()
|
qApp = mkQApp()
|
||||||
desktop = qApp.desktop()
|
screen = QtGui.QGuiApplication.primaryScreen()
|
||||||
resolution = desktop.screenGeometry()
|
screens = QtGui.QGuiApplication.screens()
|
||||||
availableResolution = desktop.availableGeometry()
|
resolution = screen.size()
|
||||||
|
availableResolution = screen.availableSize()
|
||||||
print("Screen resolution: {}x{}".format(resolution.width(), resolution.height()))
|
print("Screen resolution: {}x{}".format(resolution.width(), resolution.height()))
|
||||||
print("Available geometry: {}x{}".format(availableResolution.width(), availableResolution.height()))
|
print("Available geometry: {}x{}".format(availableResolution.width(), availableResolution.height()))
|
||||||
print("Number of Screens: {}".format(desktop.screenCount()))
|
print("Number of Screens: {}".format(len(screens)))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user