forked from github_mirror/framelesshelper
macos: verify functionality
Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
f2faf5dac3
commit
cf4e4c331b
|
@ -275,12 +275,12 @@ void FramelessHelper::Core::initialize(const Options options)
|
||||||
// and resize by yourself.
|
// and resize by yourself.
|
||||||
Utils::tryToEnableHighestDpiAwarenessLevel();
|
Utils::tryToEnableHighestDpiAwarenessLevel();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!(options & Option::DontEnsureNonNativeWidgetSiblings)) {
|
if (!(options & Option::DontEnsureNonNativeWidgetSiblings)) {
|
||||||
// This attribute is known to be __NOT__ compatible with QGLWidget.
|
// This attribute is known to be __NOT__ compatible with QGLWidget.
|
||||||
// Please consider migrating to the recommended QOpenGLWidget instead.
|
// Please consider migrating to the recommended QOpenGLWidget instead.
|
||||||
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
if (!(options & Option::DontTouchHighDpiScalingPolicy)) {
|
if (!(options & Option::DontTouchHighDpiScalingPolicy)) {
|
||||||
// Enable high DPI scaling by default, but only for Qt5 applications,
|
// Enable high DPI scaling by default, but only for Qt5 applications,
|
||||||
|
|
|
@ -59,6 +59,11 @@ FRAMELESSHELPER_STRING_CONSTANT(highcontrast)
|
||||||
|
|
||||||
Qt::CursorShape Utils::calculateCursorShape(const QWindow *window, const QPoint &pos)
|
Qt::CursorShape Utils::calculateCursorShape(const QWindow *window, const QPoint &pos)
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
Q_UNUSED(window);
|
||||||
|
Q_UNUSED(pos);
|
||||||
|
return Qt::ArrowCursor;
|
||||||
|
#else
|
||||||
Q_ASSERT(window);
|
Q_ASSERT(window);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return Qt::ArrowCursor;
|
return Qt::ArrowCursor;
|
||||||
|
@ -81,10 +86,16 @@ Qt::CursorShape Utils::calculateCursorShape(const QWindow *window, const QPoint
|
||||||
return Qt::SizeVerCursor;
|
return Qt::SizeVerCursor;
|
||||||
}
|
}
|
||||||
return Qt::ArrowCursor;
|
return Qt::ArrowCursor;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Edges Utils::calculateWindowEdges(const QWindow *window, const QPoint &pos)
|
Qt::Edges Utils::calculateWindowEdges(const QWindow *window, const QPoint &pos)
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
Q_UNUSED(window);
|
||||||
|
Q_UNUSED(pos);
|
||||||
|
return {};
|
||||||
|
#else
|
||||||
Q_ASSERT(window);
|
Q_ASSERT(window);
|
||||||
if (!window) {
|
if (!window) {
|
||||||
return {};
|
return {};
|
||||||
|
@ -106,6 +117,7 @@ Qt::Edges Utils::calculateWindowEdges(const QWindow *window, const QPoint &pos)
|
||||||
edges |= Qt::BottomEdge;
|
edges |= Qt::BottomEdge;
|
||||||
}
|
}
|
||||||
return edges;
|
return edges;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant Utils::getSystemButtonIconResource
|
QVariant Utils::getSystemButtonIconResource
|
||||||
|
|
|
@ -81,7 +81,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${SUB_PROJ_NAME} PRIVATE
|
target_link_libraries(${SUB_PROJ_NAME} PRIVATE
|
||||||
Qt${QT_VERSION_MAJOR}::Widgets
|
Qt${QT_VERSION_MAJOR}::WidgetsPrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${SUB_PROJ_NAME} PUBLIC
|
target_link_libraries(${SUB_PROJ_NAME} PUBLIC
|
||||||
|
|
|
@ -352,7 +352,6 @@ void FramelessWidgetsHelper::initialize()
|
||||||
m_initialized = true;
|
m_initialized = true;
|
||||||
// Let the user be able to get the helper class instance from outside.
|
// Let the user be able to get the helper class instance from outside.
|
||||||
q->setProperty(FRAMELESSHELPER_PROP_NAME, QVariant::fromValue(this));
|
q->setProperty(FRAMELESSHELPER_PROP_NAME, QVariant::fromValue(this));
|
||||||
#ifdef Q_OS_WINDOWS
|
|
||||||
// Without this flag, Qt will always create an invisible native parent window
|
// Without this flag, Qt will always create an invisible native parent window
|
||||||
// for any native widgets which will intercept some win32 messages and confuse
|
// for any native widgets which will intercept some win32 messages and confuse
|
||||||
// our own native event filter, so to prevent some weired bugs from happening,
|
// our own native event filter, so to prevent some weired bugs from happening,
|
||||||
|
@ -361,7 +360,6 @@ void FramelessWidgetsHelper::initialize()
|
||||||
// Force the widget become a native window now so that we can deal with its
|
// Force the widget become a native window now so that we can deal with its
|
||||||
// win32 events as soon as possible.
|
// win32 events as soon as possible.
|
||||||
q->setAttribute(Qt::WA_NativeWindow);
|
q->setAttribute(Qt::WA_NativeWindow);
|
||||||
#endif
|
|
||||||
m_params.getWindowId = [this]() -> WId { return q->winId(); };
|
m_params.getWindowId = [this]() -> WId { return q->winId(); };
|
||||||
m_params.getWindowFlags = [this]() -> Qt::WindowFlags { return q->windowFlags(); };
|
m_params.getWindowFlags = [this]() -> Qt::WindowFlags { return q->windowFlags(); };
|
||||||
m_params.setWindowFlags = [this](const Qt::WindowFlags flags) -> void { q->setWindowFlags(flags); };
|
m_params.setWindowFlags = [this](const Qt::WindowFlags flags) -> void { q->setWindowFlags(flags); };
|
||||||
|
|
Loading…
Reference in New Issue