mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-08 10:29:09 +08:00
6.6.1 patched files
This commit is contained in:
@ -42,10 +42,12 @@ static inline QDpi deviceDPI(HDC hdc)
|
||||
|
||||
static inline QDpi monitorDPI(HMONITOR hMonitor)
|
||||
{
|
||||
UINT dpiX;
|
||||
UINT dpiY;
|
||||
if (SUCCEEDED(GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY)))
|
||||
return QDpi(dpiX, dpiY);
|
||||
if (QWindowsContext::shcoredll.isValid()) {
|
||||
UINT dpiX;
|
||||
UINT dpiY;
|
||||
if (SUCCEEDED(QWindowsContext::shcoredll.getDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &dpiX, &dpiY)))
|
||||
return QDpi(dpiX, dpiY);
|
||||
}
|
||||
return {0, 0};
|
||||
}
|
||||
|
||||
@ -570,47 +572,51 @@ QRect QWindowsScreen::virtualGeometry(const QPlatformScreen *screen) // cf QScre
|
||||
bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o)
|
||||
{
|
||||
bool result = false;
|
||||
ORIENTATION_PREFERENCE orientationPreference = ORIENTATION_PREFERENCE_NONE;
|
||||
switch (o) {
|
||||
case Qt::PrimaryOrientation:
|
||||
break;
|
||||
case Qt::PortraitOrientation:
|
||||
orientationPreference = ORIENTATION_PREFERENCE_PORTRAIT;
|
||||
break;
|
||||
case Qt::LandscapeOrientation:
|
||||
orientationPreference = ORIENTATION_PREFERENCE_LANDSCAPE;
|
||||
break;
|
||||
case Qt::InvertedPortraitOrientation:
|
||||
orientationPreference = ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED;
|
||||
break;
|
||||
case Qt::InvertedLandscapeOrientation:
|
||||
orientationPreference = ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED;
|
||||
break;
|
||||
if (QWindowsContext::user32dll.setDisplayAutoRotationPreferences) {
|
||||
ORIENTATION_PREFERENCE orientationPreference = ORIENTATION_PREFERENCE_NONE;
|
||||
switch (o) {
|
||||
case Qt::PrimaryOrientation:
|
||||
break;
|
||||
case Qt::PortraitOrientation:
|
||||
orientationPreference = ORIENTATION_PREFERENCE_PORTRAIT;
|
||||
break;
|
||||
case Qt::LandscapeOrientation:
|
||||
orientationPreference = ORIENTATION_PREFERENCE_LANDSCAPE;
|
||||
break;
|
||||
case Qt::InvertedPortraitOrientation:
|
||||
orientationPreference = ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED;
|
||||
break;
|
||||
case Qt::InvertedLandscapeOrientation:
|
||||
orientationPreference = ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED;
|
||||
break;
|
||||
}
|
||||
result = QWindowsContext::user32dll.setDisplayAutoRotationPreferences(orientationPreference);
|
||||
}
|
||||
result = SetDisplayAutoRotationPreferences(orientationPreference);
|
||||
return result;
|
||||
}
|
||||
|
||||
Qt::ScreenOrientation QWindowsScreen::orientationPreference()
|
||||
{
|
||||
Qt::ScreenOrientation result = Qt::PrimaryOrientation;
|
||||
ORIENTATION_PREFERENCE orientationPreference = ORIENTATION_PREFERENCE_NONE;
|
||||
if (GetDisplayAutoRotationPreferences(&orientationPreference)) {
|
||||
switch (orientationPreference) {
|
||||
case ORIENTATION_PREFERENCE_NONE:
|
||||
break;
|
||||
case ORIENTATION_PREFERENCE_LANDSCAPE:
|
||||
result = Qt::LandscapeOrientation;
|
||||
break;
|
||||
case ORIENTATION_PREFERENCE_PORTRAIT:
|
||||
result = Qt::PortraitOrientation;
|
||||
break;
|
||||
case ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED:
|
||||
result = Qt::InvertedLandscapeOrientation;
|
||||
break;
|
||||
case ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED:
|
||||
result = Qt::InvertedPortraitOrientation;
|
||||
break;
|
||||
if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences) {
|
||||
DWORD orientationPreference = ORIENTATION_PREFERENCE_NONE;
|
||||
if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences(&orientationPreference)) {
|
||||
switch (orientationPreference) {
|
||||
case ORIENTATION_PREFERENCE_NONE:
|
||||
break;
|
||||
case ORIENTATION_PREFERENCE_LANDSCAPE:
|
||||
result = Qt::LandscapeOrientation;
|
||||
break;
|
||||
case ORIENTATION_PREFERENCE_PORTRAIT:
|
||||
result = Qt::PortraitOrientation;
|
||||
break;
|
||||
case ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED:
|
||||
result = Qt::InvertedLandscapeOrientation;
|
||||
break;
|
||||
case ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED:
|
||||
result = Qt::InvertedPortraitOrientation;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user