Fix kUseNativeChild with Qt 6.4+

This commit is contained in:
Ilya Fedin 2023-04-27 10:59:09 +04:00 committed by John Preston
parent 79b6cd347c
commit 7c9aa94533

View file

@ -24,6 +24,15 @@ namespace {
constexpr auto kUseNativeChild = false;// ::Platform::IsWindows();
class RpWidgetNoRhi : public RpWidget {
protected:
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
std::optional<QPlatformBackingStoreRhiConfig> rhiConfig() const override {
return QPlatformBackingStoreRhiConfig();
}
#endif // Qt >= 6.4.0
};
class RpWindowNoRhi : public RpWindow {
protected:
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
@ -87,7 +96,7 @@ std::unique_ptr<RpWidget> Window::createNativeBodyWrap(
return nullptr;
}
const auto create = [] {
auto result = std::make_unique<RpWidget>();
auto result = std::make_unique<RpWidgetNoRhi>();
result->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
result->setAttribute(Qt::WA_NativeWindow);
result->setAttribute(Qt::WA_DontCreateNativeAncestors);