Skip to content

Commit

Permalink
fix: can't move dialog window
Browse files Browse the repository at this point in the history
change Control to Item, as Control do not let clicks and touches through to items below them.

Issue: linuxdeepin/dtk#190
  • Loading branch information
wangfei committed Aug 13, 2024
1 parent a6ccd0f commit e4d648d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 21 deletions.
36 changes: 21 additions & 15 deletions qt6/src/qml/DialogTitleBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later

import QtQuick 2.11
import QtQuick.Window 2.11
import QtQuick.Layouts 1.11
import QtQuick
import QtQuick.Window
import QtQuick.Layouts
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style 1.0 as DS

Control {
Item {
id: control
z: D.DTK.TopOrder
width: Window.window.width
Expand Down Expand Up @@ -39,15 +39,18 @@ Control {
}
}

background: D.InWindowBlur {
D.InWindowBlur {
z: 0
id: background
visible: false
anchors.fill: parent
}

contentItem: ColumnLayout {
ColumnLayout {
id: content
spacing: 0

anchors.fill: parent
Rectangle {
id: separatorTop
Layout.preferredWidth: parent.width
Expand All @@ -63,15 +66,18 @@ Control {
Layout.preferredWidth: parent.width
Layout.leftMargin: DS.Style.titleBar.leftMargin

D.DciIcon {
id: iconLabel
visible: name !== ""
mode: control.D.ColorSelector.controlState
theme: control.D.ColorSelector.controlTheme
palette: D.DTK.makeIconPalette(control.palette)
sourceSize {
width: DS.Style.dialogWindow.iconSize
height: DS.Style.dialogWindow.iconSize
Control {
id: iconControl
contentItem: D.DciIcon {
id: iconLabel
visible: name !== ""
mode: iconControl.D.ColorSelector.controlState
theme: iconControl.D.ColorSelector.controlTheme
palette: D.DTK.makeIconPalette(iconControl.palette)
sourceSize {
width: DS.Style.dialogWindow.iconSize
height: DS.Style.dialogWindow.iconSize
}
}
}

Expand Down
12 changes: 6 additions & 6 deletions qt6/src/qml/DialogWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later

import QtQuick 2.11
import QtQuick.Layouts 1.11
import QtQuick.Window 2.11
import QtQuick
import QtQuick.Layouts
import QtQuick.Window
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style 1.0 as DS

Expand All @@ -31,16 +31,16 @@ Window {
default property alias content: contentLoader.children
property alias palette : content.palette

Control {
Item {
id: content
palette: control.active ? D.DTK.palette : D.DTK.inactivePalette
contentItem: ColumnLayout {
implicitHeight: childrenRect.height
ColumnLayout {
id: layout
spacing: 0

Loader {
id: titleBar
z: D.DTK.TopOrder
sourceComponent: DialogTitleBar {
enableInWindowBlendBlur: true
icon.name: control.icon
Expand Down

0 comments on commit e4d648d

Please sign in to comment.