Fix widget external windows

This commit is contained in:
Alex Spataru 2021-11-09 16:37:24 -06:00
parent c6050dd39e
commit 3b1069352f
11 changed files with 85 additions and 54 deletions

View File

@ -64,20 +64,49 @@ Item {
id: externalWindow
minimumWidth: 640
minimumHeight: 480
titlebarBorderEnabled: false
title: externalLoader.widgetTitle
titlebarText: Cpp_ThemeManager.text
titlebarColor: Cpp_ThemeManager.widgetWindowBackground
backgroundColor: Cpp_ThemeManager.widgetWindowBackground
WidgetLoader {
id: externalLoader
Rectangle {
clip: true
anchors.fill: parent
isExternalWindow: true
widgetIndex: root.widgetIndex
widgetVisible: externalWindow.visible
radius: externalWindow.radius
anchors.margins: externalWindow.shadowMargin
anchors.topMargin: externalWindow.titlebar.height
color: Cpp_ThemeManager.widgetWindowBackground
anchors.topMargin: externalWindow.titlebar.height + externalWindow.shadowMargin
Item {
anchors.fill: parent
DragHandler {
grabPermissions: TapHandler.CanTakeOverFromAnything
onActiveChanged: {
if (active)
externalWindow.startSystemMove()
}
}
}
Rectangle {
height: externalWindow.radius
color: Cpp_ThemeManager.widgetWindowBackground
anchors {
top: parent.top
left: parent.left
right: parent.right
}
}
WidgetLoader {
id: externalLoader
anchors.fill: parent
isExternalWindow: true
widgetIndex: root.widgetIndex
widgetVisible: externalWindow.visible
anchors.margins: externalWindow.radius
}
MouseArea {
hoverEnabled: true

View File

@ -90,7 +90,6 @@ Window {
property alias closeEnabled: border.closeEnabled
property alias minimizeEnabled: border.minimizeEnabled
property alias maximizeEnabled: border.maximizeEnabled
property alias titlebarBorderEnabled: border.titlebarBorderEnabled
//
// Shadow implementation

View File

@ -42,12 +42,11 @@ Rectangle {
// Window controls
//
property Window window
property bool displayIcon: true
property bool fullScreen: false
property bool closeEnabled: true
property bool minimizeEnabled: true
property bool maximizeEnabled: true
property bool displayIcon: true
property bool titlebarBorderEnabled: true
property color textColor: palette.text
readonly property bool showMacControls: Cpp_IsMac
@ -95,21 +94,6 @@ Rectangle {
}
}
//
// Bottom titlebar border
//
Rectangle {
height: 1
visible: root.titlebarBorderEnabled
color: Qt.darker(parent.color, 1.5)
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
}
//
// Window drag handler
//

View File

@ -32,11 +32,32 @@ Rectangle {
//
// Background & border
//
border.width: 1
border.color: Cpp_ThemeManager.toolbarGradient1
gradient: Gradient {
GradientStop { position: 0; color: Cpp_ThemeManager.toolbarGradient1 }
GradientStop { position: 1; color: Cpp_ThemeManager.toolbarGradient2 }
Rectangle {
id: bg
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0; color: Cpp_ThemeManager.toolbarGradient1 }
GradientStop { position: 1; color: Cpp_ThemeManager.toolbarGradient2 }
}
Rectangle {
border.width: 1
anchors.fill: parent
color: "transparent"
border.color: Qt.darker(Cpp_ThemeManager.toolbarGradient2, 1.5)
}
Rectangle {
height: 1
color: Qt.darker(Cpp_ThemeManager.toolbarGradient1, 1.5)
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
}
}
}
//

View File

@ -86,10 +86,23 @@ Control {
}
//
// Background gradient
// Background gradient + border
//
Rectangle {
id: bg
anchors.fill: parent
gradient: Gradient {
GradientStop { position: 0; color: Cpp_ThemeManager.toolbarGradient1 }
GradientStop { position: 1; color: Cpp_ThemeManager.toolbarGradient2 }
}
Rectangle {
border.width: 1
anchors.fill: parent
color: "transparent"
border.color: Qt.darker(Cpp_ThemeManager.toolbarGradient2, 1.5)
}
Rectangle {
height: 1
@ -101,17 +114,6 @@ Control {
bottom: parent.bottom
}
}
gradient: Gradient {
GradientStop { position: 0; color: Cpp_ThemeManager.toolbarGradient1 }
GradientStop { position: 1; color: Cpp_ThemeManager.toolbarGradient2 }
}
anchors {
fill: parent
leftMargin: -border.width * 10
rightMargin: -border.width * 10
}
}
//

View File

@ -51,10 +51,9 @@ FramelessWindow.CustomWindow {
//
// Titlebar options
//
displayIcon: false
minimizeEnabled: false
maximizeEnabled: false
displayIcon: false
titlebarBorderEnabled: false
titlebarText: Cpp_ThemeManager.text
titlebarColor: Cpp_ThemeManager.dialogBackground
backgroundColor: Cpp_ThemeManager.dialogBackground

View File

@ -33,13 +33,12 @@ FramelessWindow.CustomWindow {
//
// Window options
//
title: qsTr("Acknowledgements")
displayIcon: false
width: minimumWidth
height: minimumHeight
minimizeEnabled: false
maximizeEnabled: false
displayIcon: false
titlebarBorderEnabled: false
title: qsTr("Acknowledgements")
titlebarText: Cpp_ThemeManager.text
x: (Screen.desktopAvailableWidth - width) / 2
y: (Screen.desktopAvailableHeight - height) / 2

View File

@ -33,13 +33,12 @@ FramelessWindow.CustomWindow {
//
// Window options
//
title: qsTr("CSV Player")
displayIcon: false
width: minimumWidth
height: minimumHeight
minimizeEnabled: false
maximizeEnabled: false
displayIcon: false
titlebarBorderEnabled: false
title: qsTr("CSV Player")
titlebarText: Cpp_ThemeManager.text
x: (Screen.desktopAvailableWidth - width) / 2
y: (Screen.desktopAvailableHeight - height) / 2

View File

@ -34,13 +34,12 @@ FramelessWindow.CustomWindow {
//
// Window options
//
displayIcon: false
title: qsTr("Donate")
width: minimumWidth
height: minimumHeight
minimizeEnabled: false
maximizeEnabled: false
displayIcon: false
titlebarBorderEnabled: false
titlebarText: Cpp_ThemeManager.text
x: (Screen.desktopAvailableWidth - width) / 2
y: (Screen.desktopAvailableHeight - height) / 2

View File

@ -40,7 +40,7 @@ FramelessWindow.CustomWindow {
minimumWidth: 910
minimumHeight: 720
displayIcon: false
borderColor: Cpp_ThemeManager.toolbarGradient1
borderColor: Qt.darker(Cpp_ThemeManager.toolbarGradient2, 1.5)
title: qsTr("JSON Editor - %1").arg(Cpp_JSON_Editor.jsonFileName)
//

View File

@ -37,7 +37,7 @@ import "../PlatformDependent" as PlatformDependent
FramelessWindow.CustomWindow {
id: root
onClosed: Qt.quit()
borderColor: Cpp_ThemeManager.toolbarGradient1
borderColor: Qt.darker(Cpp_ThemeManager.toolbarGradient2, 1.5)
//
// Global properties