Minor tweaks

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2021-07-06 10:54:11 +08:00
parent c29c4cc409
commit 151e8a1664
7 changed files with 9 additions and 4 deletions

View File

@ -27,7 +27,6 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
// High DPI scaling is enabled by default from Qt 6 // High DPI scaling is enabled by default from Qt 6
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// Windows: we are using the manifest file to get maximum compatibility // Windows: we are using the manifest file to get maximum compatibility

View File

@ -29,6 +29,9 @@
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags)
{ {
setAttribute(Qt::WA_DontCreateNativeAncestors);
createWinId();
appMainWindow = new Ui::MainWindow; appMainWindow = new Ui::MainWindow;
appMainWindow->setupUi(this); appMainWindow->setupUi(this);

View File

@ -30,7 +30,6 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
// High DPI scaling is enabled by default from Qt 6 // High DPI scaling is enabled by default from Qt 6
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// Windows: we are using the manifest file to get maximum compatibility // Windows: we are using the manifest file to get maximum compatibility

View File

@ -27,7 +27,6 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
// High DPI scaling is enabled by default from Qt 6 // High DPI scaling is enabled by default from Qt 6
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// Windows: we are using the manifest file to get maximum compatibility // Windows: we are using the manifest file to get maximum compatibility

View File

@ -34,6 +34,7 @@
Widget::Widget(QWidget *parent) : QWidget(parent) Widget::Widget(QWidget *parent) : QWidget(parent)
{ {
setAttribute(Qt::WA_DontCreateNativeAncestors);
createWinId(); createWinId();
setupUi(); setupUi();
startTimer(500); startTimer(500);

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="com.wangwenx190.framelessapplication" version="1.0.0.0"/> <assemblyIdentity type="win32" name="org.wangwenx190.framelessapplication" version="1.0.0.0"/>
<dependency> <dependency>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>

View File

@ -25,6 +25,7 @@
#include "framelesswindowsmanager.h" #include "framelesswindowsmanager.h"
#include <QtCore/qvariant.h> #include <QtCore/qvariant.h>
#include <QtCore/qdebug.h> #include <QtCore/qdebug.h>
#include <QtCore/qcoreapplication.h>
#include <QtGui/qwindow.h> #include <QtGui/qwindow.h>
#include "utilities.h" #include "utilities.h"
#ifdef FRAMELESSHELPER_USE_UNIX_VERSION #ifdef FRAMELESSHELPER_USE_UNIX_VERSION
@ -44,6 +45,9 @@ void FramelessWindowsManager::addWindow(QWindow *window)
if (!window) { if (!window) {
return; return;
} }
if (!QCoreApplication::testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)) {
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
}
#ifdef FRAMELESSHELPER_USE_UNIX_VERSION #ifdef FRAMELESSHELPER_USE_UNIX_VERSION
framelessHelperUnix()->removeWindowFrame(window); framelessHelperUnix()->removeWindowFrame(window);
#else #else