mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2024-11-27 14:38:28 +08:00
Compare commits
No commits in common. "c4707639b44ea716f94d9acbcf013ef305aac8a3" and "61d77a3278e48edb3a9bc4c033239c7e7f20df6a" have entirely different histories.
c4707639b4
...
61d77a3278
@ -1,13 +1,13 @@
|
|||||||
This is Qt 6.7.3 **qtbase module** backport that runs on Windows 7/8. The repository contains patched source files from the qtbase module.
|
This is Qt 6.7.2 **qtbase module** backport that runs on Windows 7/8. The repository contains patched source files from the qtbase module.
|
||||||
Approach is based on this [forum thread](https://forum.qt.io/topic/133002/qt-creator-6-0-1-and-qt-6-2-2-running-on-windows-7/60) but better: many improvements amongst important fallbacks to default Qt 6 behaviour when running on newer Windows.
|
Approach is based on this [forum thread](https://forum.qt.io/topic/133002/qt-creator-6-0-1-and-qt-6-2-2-running-on-windows-7/60) but better: many improvements amongst important fallbacks to default Qt 6 behaviour when running on newer Windows.
|
||||||
|
|
||||||
- After replacing qtbase source files with the patched ones from this repository, you can compile Qt yourself using compiler and build options you need.
|
- After replacing qtbase source files with the patched ones from this repository, you can compile Qt yourself using compiler and build options you need.
|
||||||
- You can use our [compile_win.pl](https://github.com/crystalidea/qt-build-tools/tree/master/6.7.3) build script (uses Visual C++ 2022 with OpenSSL 3.0.13 statically linked)
|
- You can use our [compile_win.pl](https://github.com/crystalidea/qt-build-tools/tree/master/6.7.2) build script (uses Visual C++ 2022 with OpenSSL 3.0.13 statically linked)
|
||||||
- You can download our [prebuild Qt dlls](https://github.com/crystalidea/qt6windows7/releases) which also have Qt Designer binary for demonstration
|
- You can download our [prebuild Qt dlls](https://github.com/crystalidea/qt6windows7/releases) which also have Qt Designer binary for demonstration
|
||||||
|
|
||||||
**Qt 6.7.3 designer running on Windows 7**:
|
**Qt 6.7.2 designer running on Windows 7**:
|
||||||
|
|
||||||
![Qt Designer](designer.png)
|
![image](https://github.com/crystalidea/qt6windows7/assets/2600624/41f4291a-082a-41e8-a09d-c3b9e7f36e9e)
|
||||||
|
|
||||||
### Known issues:
|
### Known issues:
|
||||||
|
|
||||||
|
BIN
designer.png
BIN
designer.png
Binary file not shown.
Before Width: | Height: | Size: 76 KiB |
@ -2872,7 +2872,7 @@ void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD)
|
|||||||
break;
|
break;
|
||||||
case QD3D11CommandBuffer::Command::Draw:
|
case QD3D11CommandBuffer::Command::Draw:
|
||||||
if (cmd.args.draw.ps) {
|
if (cmd.args.draw.ps) {
|
||||||
if (cmd.args.draw.instanceCount == 1 && cmd.args.draw.firstInstance == 0)
|
if (cmd.args.draw.instanceCount == 1)
|
||||||
context->Draw(cmd.args.draw.vertexCount, cmd.args.draw.firstVertex);
|
context->Draw(cmd.args.draw.vertexCount, cmd.args.draw.firstVertex);
|
||||||
else
|
else
|
||||||
context->DrawInstanced(cmd.args.draw.vertexCount, cmd.args.draw.instanceCount,
|
context->DrawInstanced(cmd.args.draw.vertexCount, cmd.args.draw.instanceCount,
|
||||||
@ -2883,7 +2883,7 @@ void QRhiD3D11::executeCommandBuffer(QD3D11CommandBuffer *cbD)
|
|||||||
break;
|
break;
|
||||||
case QD3D11CommandBuffer::Command::DrawIndexed:
|
case QD3D11CommandBuffer::Command::DrawIndexed:
|
||||||
if (cmd.args.drawIndexed.ps) {
|
if (cmd.args.drawIndexed.ps) {
|
||||||
if (cmd.args.drawIndexed.instanceCount == 1 && cmd.args.drawIndexed.firstInstance == 0)
|
if (cmd.args.drawIndexed.instanceCount == 1)
|
||||||
context->DrawIndexed(cmd.args.drawIndexed.indexCount, cmd.args.drawIndexed.firstIndex,
|
context->DrawIndexed(cmd.args.drawIndexed.indexCount, cmd.args.drawIndexed.firstIndex,
|
||||||
cmd.args.drawIndexed.vertexOffset);
|
cmd.args.drawIndexed.vertexOffset);
|
||||||
else
|
else
|
||||||
|
@ -256,9 +256,8 @@ void QWindowsOleDropSource::createCursors()
|
|||||||
if (const QScreen *primaryScreen = QGuiApplication::primaryScreen())
|
if (const QScreen *primaryScreen = QGuiApplication::primaryScreen())
|
||||||
platformScreen = primaryScreen->handle();
|
platformScreen = primaryScreen->handle();
|
||||||
}
|
}
|
||||||
QPlatformCursor *platformCursor = nullptr;
|
Q_ASSERT(platformScreen);
|
||||||
if (platformScreen)
|
QPlatformCursor *platformCursor = platformScreen->cursor();
|
||||||
platformCursor = platformScreen->cursor();
|
|
||||||
|
|
||||||
if (GetSystemMetrics (SM_REMOTESESSION) != 0) {
|
if (GetSystemMetrics (SM_REMOTESESSION) != 0) {
|
||||||
/* Workaround for RDP issues with large cursors.
|
/* Workaround for RDP issues with large cursors.
|
||||||
@ -275,7 +274,7 @@ void QWindowsOleDropSource::createCursors()
|
|||||||
hotSpotScaleFactor = QHighDpiScaling::factor(platformScreen);
|
hotSpotScaleFactor = QHighDpiScaling::factor(platformScreen);
|
||||||
pixmapScaleFactor = hotSpotScaleFactor / pixmap.devicePixelRatio();
|
pixmapScaleFactor = hotSpotScaleFactor / pixmap.devicePixelRatio();
|
||||||
}
|
}
|
||||||
QPixmap scaledPixmap = (!hasPixmap || qFuzzyCompare(pixmapScaleFactor, 1.0))
|
QPixmap scaledPixmap = qFuzzyCompare(pixmapScaleFactor, 1.0)
|
||||||
? pixmap
|
? pixmap
|
||||||
: pixmap.scaled((QSizeF(pixmap.size()) * pixmapScaleFactor).toSize(),
|
: pixmap.scaled((QSizeF(pixmap.size()) * pixmapScaleFactor).toSize(),
|
||||||
Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
@ -142,18 +142,6 @@ struct DiRegKeyHandleTraits
|
|||||||
|
|
||||||
using DiRegKeyHandle = QUniqueHandle<DiRegKeyHandleTraits>;
|
using DiRegKeyHandle = QUniqueHandle<DiRegKeyHandleTraits>;
|
||||||
|
|
||||||
struct DevInfoHandleTraits
|
|
||||||
{
|
|
||||||
using Type = HDEVINFO;
|
|
||||||
static Type invalidValue()
|
|
||||||
{
|
|
||||||
return reinterpret_cast<HDEVINFO>(INVALID_HANDLE_VALUE);
|
|
||||||
}
|
|
||||||
static bool close(Type handle) { return SetupDiDestroyDeviceInfoList(handle) == TRUE; }
|
|
||||||
};
|
|
||||||
|
|
||||||
using DevInfoHandle = QUniqueHandle<DevInfoHandleTraits>;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
|
static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
|
||||||
@ -203,16 +191,13 @@ static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
|
|||||||
constexpr GUID GUID_DEVINTERFACE_MONITOR = {
|
constexpr GUID GUID_DEVINTERFACE_MONITOR = {
|
||||||
0xe6f07b5f, 0xee97, 0x4a90, { 0xb0, 0x76, 0x33, 0xf5, 0x7b, 0xf4, 0xea, 0xa7 }
|
0xe6f07b5f, 0xee97, 0x4a90, { 0xb0, 0x76, 0x33, 0xf5, 0x7b, 0xf4, 0xea, 0xa7 }
|
||||||
};
|
};
|
||||||
const DevInfoHandle devInfo{ SetupDiGetClassDevs(
|
const HDEVINFO devInfo = SetupDiGetClassDevs(&GUID_DEVINTERFACE_MONITOR, nullptr, nullptr,
|
||||||
&GUID_DEVINTERFACE_MONITOR, nullptr, nullptr, DIGCF_DEVICEINTERFACE) };
|
DIGCF_DEVICEINTERFACE);
|
||||||
|
|
||||||
if (!devInfo.isValid())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SP_DEVICE_INTERFACE_DATA deviceInterfaceData{};
|
SP_DEVICE_INTERFACE_DATA deviceInterfaceData{};
|
||||||
deviceInterfaceData.cbSize = sizeof(deviceInterfaceData);
|
deviceInterfaceData.cbSize = sizeof(deviceInterfaceData);
|
||||||
|
|
||||||
if (!SetupDiOpenDeviceInterfaceW(devInfo.get(), deviceName.monitorDevicePath, DIODI_NO_ADD,
|
if (!SetupDiOpenDeviceInterfaceW(devInfo, deviceName.monitorDevicePath, DIODI_NO_ADD,
|
||||||
&deviceInterfaceData)) {
|
&deviceInterfaceData)) {
|
||||||
qCWarning(lcQpaScreen)
|
qCWarning(lcQpaScreen)
|
||||||
<< u"Unable to open monitor interface to %1:"_s.arg(data.deviceName)
|
<< u"Unable to open monitor interface to %1:"_s.arg(data.deviceName)
|
||||||
@ -221,7 +206,7 @@ static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DWORD requiredSize{ 0 };
|
DWORD requiredSize{ 0 };
|
||||||
if (SetupDiGetDeviceInterfaceDetailW(devInfo.get(), &deviceInterfaceData, nullptr, 0,
|
if (SetupDiGetDeviceInterfaceDetailW(devInfo, &deviceInterfaceData, nullptr, 0,
|
||||||
&requiredSize, nullptr)
|
&requiredSize, nullptr)
|
||||||
|| GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
|
|| GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
|
||||||
continue;
|
continue;
|
||||||
@ -232,7 +217,7 @@ static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
|
|||||||
devicePath->cbSize = sizeof(std::remove_pointer_t<decltype(devicePath)>);
|
devicePath->cbSize = sizeof(std::remove_pointer_t<decltype(devicePath)>);
|
||||||
SP_DEVINFO_DATA deviceInfoData{};
|
SP_DEVINFO_DATA deviceInfoData{};
|
||||||
deviceInfoData.cbSize = sizeof(deviceInfoData);
|
deviceInfoData.cbSize = sizeof(deviceInfoData);
|
||||||
if (!SetupDiGetDeviceInterfaceDetailW(devInfo.get(), &deviceInterfaceData, devicePath,
|
if (!SetupDiGetDeviceInterfaceDetailW(devInfo, &deviceInterfaceData, devicePath,
|
||||||
requiredSize, nullptr, &deviceInfoData)) {
|
requiredSize, nullptr, &deviceInfoData)) {
|
||||||
qCDebug(lcQpaScreen) << u"Unable to get monitor metadata for %1:"_s.arg(data.deviceName)
|
qCDebug(lcQpaScreen) << u"Unable to get monitor metadata for %1:"_s.arg(data.deviceName)
|
||||||
<< QSystemError::windowsString();
|
<< QSystemError::windowsString();
|
||||||
@ -240,7 +225,7 @@ static void setMonitorDataFromSetupApi(QWindowsScreenData &data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DiRegKeyHandle edidRegistryKey{ SetupDiOpenDevRegKey(
|
const DiRegKeyHandle edidRegistryKey{ SetupDiOpenDevRegKey(
|
||||||
devInfo.get(), &deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ) };
|
devInfo, &deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_READ) };
|
||||||
|
|
||||||
if (!edidRegistryKey.isValid())
|
if (!edidRegistryKey.isValid())
|
||||||
continue;
|
continue;
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
#include <QtCore/qlibraryinfo.h>
|
#include <QtCore/qlibraryinfo.h>
|
||||||
#include <QtCore/qoperatingsystemversion.h>
|
|
||||||
|
|
||||||
#include <dwmapi.h>
|
#include <dwmapi.h>
|
||||||
|
|
||||||
@ -2177,8 +2176,11 @@ void QWindowsWindow::setGeometry(const QRect &rectIn)
|
|||||||
const QMargins margins = frameMargins();
|
const QMargins margins = frameMargins();
|
||||||
rect.moveTopLeft(rect.topLeft() + QPoint(margins.left(), margins.top()));
|
rect.moveTopLeft(rect.topLeft() + QPoint(margins.left(), margins.top()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_windowState & Qt::WindowMinimized)
|
if (m_windowState & Qt::WindowMinimized)
|
||||||
m_data.geometry = rect; // Otherwise set by handleGeometryChange() triggered by event.
|
m_data.geometry = rect; // Otherwise set by handleGeometryChange() triggered by event.
|
||||||
|
else
|
||||||
|
setWindowState(Qt::WindowNoState);// Update window state to WindowNoState unless minimized
|
||||||
|
|
||||||
if (m_data.hwnd) {
|
if (m_data.hwnd) {
|
||||||
// A ResizeEvent with resulting geometry will be sent. If we cannot
|
// A ResizeEvent with resulting geometry will be sent. If we cannot
|
||||||
@ -2488,12 +2490,6 @@ QWindowsWindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool QWindowsBaseWindow::hasMaximumSize() const
|
|
||||||
{
|
|
||||||
const auto maximumSize = window()->maximumSize();
|
|
||||||
return maximumSize.width() != QWINDOWSIZE_MAX || maximumSize.height() != QWINDOWSIZE_MAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWindowsWindow::handleWindowStateChange(Qt::WindowStates state)
|
void QWindowsWindow::handleWindowStateChange(Qt::WindowStates state)
|
||||||
{
|
{
|
||||||
qCDebug(lcQpaWindow) << __FUNCTION__ << this << window()
|
qCDebug(lcQpaWindow) << __FUNCTION__ << this << window()
|
||||||
@ -2510,21 +2506,6 @@ void QWindowsWindow::handleWindowStateChange(Qt::WindowStates state)
|
|||||||
GetWindowPlacement(m_data.hwnd, &windowPlacement);
|
GetWindowPlacement(m_data.hwnd, &windowPlacement);
|
||||||
const RECT geometry = RECTfromQRect(m_data.restoreGeometry);
|
const RECT geometry = RECTfromQRect(m_data.restoreGeometry);
|
||||||
windowPlacement.rcNormalPosition = geometry;
|
windowPlacement.rcNormalPosition = geometry;
|
||||||
|
|
||||||
// A bug in windows 10 grows
|
|
||||||
// - ptMaxPosition.x by the task bar's width, if it's on the left
|
|
||||||
// - ptMaxPosition.y by the task bar's height, if it's on the top
|
|
||||||
// each time GetWindowPlacement() is called.
|
|
||||||
// The offset of the screen's left edge (as per frameMargins_sys().left()) is ignored.
|
|
||||||
// => Check for windows 10 and correct.
|
|
||||||
static const auto windows11 = QOperatingSystemVersion::Windows11_21H2;
|
|
||||||
static const bool isWindows10 = QOperatingSystemVersion::current() < windows11;
|
|
||||||
if (isWindows10 && hasMaximumSize()) {
|
|
||||||
const QMargins margins = frameMargins_sys();
|
|
||||||
const QPoint topLeft = window()->screen()->geometry().topLeft();
|
|
||||||
windowPlacement.ptMaxPosition = POINT{ topLeft.x() - margins.left(), topLeft.y() };
|
|
||||||
}
|
|
||||||
|
|
||||||
// Even if the window is hidden, windowPlacement's showCmd is not SW_HIDE, so change it
|
// Even if the window is hidden, windowPlacement's showCmd is not SW_HIDE, so change it
|
||||||
// manually to avoid unhiding a hidden window with the subsequent call to
|
// manually to avoid unhiding a hidden window with the subsequent call to
|
||||||
// SetWindowPlacement().
|
// SetWindowPlacement().
|
||||||
|
Loading…
Reference in New Issue
Block a user