RibbonWindow: Enable blur behind window for Windows.
This commit is contained in:
parent
3e0e94a2a5
commit
863c61325a
|
@ -21,7 +21,7 @@ BEGIN
|
|||
BEGIN
|
||||
VALUE "Comments", "Made by Mentalflow."
|
||||
VALUE "CompanyName", "${PROJECT_COMPANY}"
|
||||
VALUE "FileDescription", "${PROJECT_COPYRIGHT}"
|
||||
VALUE "FileDescription", "${PROJECT_BUNDLE_NAME}"
|
||||
VALUE "FileVersion", "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}"
|
||||
VALUE "InternalName", "${PROJECT_BUNDLE_NAME}.exe"
|
||||
VALUE "LegalCopyright", "${PROJECT_COPYRIGHT}"
|
||||
|
|
|
@ -7,8 +7,7 @@ RibbonWindow {
|
|||
id: window
|
||||
width: Math.max(content.width, content.height + title_bar.height, title_bar.minimumWidth) + content.anchors.margins * 2
|
||||
minimumWidth: title_bar.minimumWidth
|
||||
minimumHeight: content.height + title_bar.height
|
||||
height: width
|
||||
minimumHeight: content.height + title_bar.height + content.anchors.margins * 2
|
||||
title: qsTr("About")
|
||||
title_bar.show_darkmode_btn: false
|
||||
title_bar.show_style_switch: false
|
||||
|
|
|
@ -21,6 +21,9 @@ if(APPLE)
|
|||
endif()
|
||||
|
||||
if (RIBBONUI_BUILD_QWINDOWKIT)
|
||||
if(WIN32)
|
||||
set(QWINDOWKIT_ENABLE_WINDOWS_SYSTEM_BORDERS OFF)
|
||||
endif()
|
||||
set(QWINDOWKIT_BUILD_STATIC ON)
|
||||
set(QWINDOWKIT_BUILD_EXAMPLES OFF)
|
||||
set(QWINDOWKIT_BUILD_QUICK ON)
|
||||
|
|
|
@ -16,7 +16,7 @@ Window {
|
|||
property alias title_bar: titleBar
|
||||
property alias popup: pop
|
||||
property bool comfirmed_quit: false
|
||||
property bool blurBehindWindow: false
|
||||
property bool blurBehindWindow: true
|
||||
visible: false
|
||||
color: {
|
||||
if (blurBehindWindow) {
|
||||
|
@ -29,7 +29,7 @@ Window {
|
|||
}
|
||||
onBlurBehindWindowChanged: {
|
||||
if (Qt.platform.os === 'windows')
|
||||
windowAgent.setWindowAttribute("acrylic-material", blurBehindWindow)
|
||||
windowAgent.setWindowAttribute("mica", blurBehindWindow)
|
||||
else if (Qt.platform.os === 'osx')
|
||||
windowAgent.setWindowAttribute("blur-effect", blurBehindWindow ? RibbonTheme.dark_mode ? "dark" : "light" : "none")
|
||||
}
|
||||
|
@ -38,22 +38,23 @@ Window {
|
|||
windowAgent.setup(window)
|
||||
if (Qt.platform.os === 'windows')
|
||||
{
|
||||
windowAgent.setWindowAttribute("acrylic-material", blurBehindWindow)
|
||||
windowAgent.setWindowAttribute("mica", blurBehindWindow)
|
||||
windowAgent.setSystemButton(WindowAgent.Minimize, titleBar.minimizeBtn);
|
||||
windowAgent.setSystemButton(WindowAgent.Maximize, titleBar.maximizeBtn);
|
||||
windowAgent.setSystemButton(WindowAgent.Close, titleBar.closeBtn);
|
||||
}
|
||||
if(Qt.platform.os === "osx")
|
||||
{
|
||||
blurBehindWindow = true
|
||||
windowAgent.setWindowAttribute("blur-effect", blurBehindWindow ? RibbonTheme.dark_mode ? "dark" : "light" : "none")
|
||||
PlatformSupport.showSystemTitleBtns(window, true)
|
||||
}
|
||||
windowAgent.setHitTestVisible(titleBar.left_container)
|
||||
windowAgent.setHitTestVisible(titleBar.right_container)
|
||||
windowAgent.setTitleBar(titleBar);
|
||||
windowAgent.setTitleBar(titleBar)
|
||||
windowAgent.centralize()
|
||||
window.visible = true;
|
||||
window.flags ^= Qt.WA_AlwaysShowToolTips // It's a trick for Windows
|
||||
window.visible = true
|
||||
window.flags ^= Qt.WA_AlwaysShowToolTips // It's a trick for Windows
|
||||
}
|
||||
Item{
|
||||
id: window_items
|
||||
|
@ -98,7 +99,7 @@ Window {
|
|||
color: 'transparent'
|
||||
border.color: RibbonTheme.dark_mode ? "#7A7A7A" : "#2C59B7"
|
||||
border.width: RibbonTheme.modern_style ? 1 : 0
|
||||
radius: Qt.platform.os === 'windows' ? 8 : 10
|
||||
radius: Qt.platform.os === 'windows' ? 7 : 10
|
||||
visible: RibbonTheme.modern_style
|
||||
}
|
||||
RibbonPopup{
|
||||
|
|
|
@ -32,6 +32,9 @@ void RibbonUI::init()
|
|||
qputenv("QT_QUICK_CONTROLS_STYLE", "Basic");
|
||||
#else
|
||||
qputenv("QT_QUICK_CONTROLS_STYLE", "Default");
|
||||
#endif
|
||||
#ifdef Q_OS_WIN
|
||||
qputenv("QSG_RHI_BACKEND", "opengl");
|
||||
#endif
|
||||
QQuickWindow::setDefaultAlphaBuffer(true);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue