官方有提到该问题。尤其是使用qml时,一定会出现这个遮挡问题。
https://doc.qt.io/qt-5/windows-issues.html
默认的qml工程的解决代码如下:
1 ... 2 #include <QWindow> 3 #include <QtPlatformHeaders/QWindowsWindowFunctions> 4 ... 5 6 int main(int argc, char *argv[]) 7 { 8 ... 9 QQmlApplicationEngine engine; 10 const QUrl url(QStringLiteral("qrc:/qml/main.qml")); 11 QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, 12 &app, [url](QObject *obj, const QUrl &objUrl) { 13 if (!obj && url == objUrl) 14 QCoreApplication::exit(-1); 15 }, Qt::QueuedConnection); 16 engine.load(url); 17 18 auto tlwWindow = (QWindow*)engine.rootObjects().first(); 19 QWindowsWindowFunctions::setHasBorderInFullScreen(tlwWindow, true); 20 ... 21 }
标签:engine,...,Qt,tlwWindow,url,qml,全屏 From: https://www.cnblogs.com/ybqjymy/p/18036836