From 9f5665979bc0dede17ef0be6216cd6182b41ba7f Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Thu, 23 Oct 2025 15:31:52 +0800 Subject: [PATCH] chore: can't use ScrollView in qt5 as title. --- src/qml/ScrollView.qml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/qml/ScrollView.qml b/src/qml/ScrollView.qml index 6e8b8d458..c57262047 100644 --- a/src/qml/ScrollView.qml +++ b/src/qml/ScrollView.qml @@ -2,8 +2,32 @@ // // SPDX-License-Identifier: LGPL-3.0-or-later -import QtQuick.Controls 2.4 +import QtQuick 2.12 +import QtQuick.Controls.impl 2.12 +import QtQuick.Templates 2.12 as T +import org.deepin.dtk 1.0 as D -ScrollView { +T.ScrollView { + id: control + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, + contentWidth + leftPadding + rightPadding) + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, + contentHeight + topPadding + bottomPadding) + + D.ScrollBar.vertical: D.ScrollBar { + parent: control + x: control.mirrored ? 0 : control.width - width + y: control.topPadding + height: control.availableHeight + active: control.D.ScrollBar.horizontal.active + } + + D.ScrollBar.horizontal: D.ScrollBar { + parent: control + x: control.leftPadding + y: control.height - height + width: control.availableWidth + active: control.D.ScrollBar.vertical.active + } }