Skip to content

Commit d5f2c23

Browse files
deepin-ci-robot18202781743
authored andcommitted
sync: from linuxdeepin/dtkdeclarative
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#488
1 parent 8986956 commit d5f2c23

6 files changed

Lines changed: 46 additions & 5 deletions

File tree

chameleon/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ set(QML_FILES
3535
RadioButton.qml
3636
RoundButton.qml
3737
ScrollBar.qml
38+
ScrollView.qml
3839
ScrollIndicator.qml
3940
Slider.qml
4041
SpinBox.qml

chameleon/ScrollView.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-FileCopyrightText: 2020 - 2022 UnionTech Software Technology Co., Ltd.
2+
//
3+
// SPDX-License-Identifier: LGPL-3.0-or-later
4+
5+
import org.deepin.dtk 1.0 as D
6+
7+
D.ScrollView {
8+
9+
}
10+

chameleon/qml.qrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<file>RadioButton.qml</file>
2424
<file>RoundButton.qml</file>
2525
<file>ScrollBar.qml</file>
26+
<file>ScrollView.qml</file>
2627
<file>ScrollIndicator.qml</file>
2728
<file>Slider.qml</file>
2829
<file>SpinBox.qml</file>

qmlplugin/qmlplugin_plugin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ void QmlpluginPlugin::registerTypes(const char *uri)
254254
dtkRegisterType(uri, controlsUri, 1, 0, "ScrollIndicator");
255255
dtkRegisterType(uri, controlsUri, 1, 0, "Popup");
256256
dtkRegisterType(uri, controlsUri, 1, 0, "ScrollBar");
257+
dtkRegisterType(uri, controlsUri, 1, 0, "ScrollView");
257258
// DTK Controls
258259
dtkRegisterType(uri, controlsUri, 1, 0, "LineEdit");
259260
dtkRegisterType(uri, controlsUri, 1, 0, "SearchEdit");

qt6/src/qml/ScrollView.qml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,32 @@
22
//
33
// SPDX-License-Identifier: LGPL-3.0-or-later
44

5-
import QtQuick.Controls
5+
import QtQuick
6+
import QtQuick.Controls.impl
7+
import QtQuick.Templates as T
8+
import org.deepin.dtk 1.0 as D
69

7-
ScrollView {
10+
T.ScrollView {
11+
id: control
812

13+
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
14+
contentWidth + leftPadding + rightPadding)
15+
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
16+
contentHeight + topPadding + bottomPadding)
17+
18+
D.ScrollBar.vertical: D.ScrollBar {
19+
parent: control
20+
x: control.mirrored ? 0 : control.width - width
21+
y: control.topPadding
22+
height: control.availableHeight
23+
active: control.D.ScrollBar.horizontal.active
24+
}
25+
26+
D.ScrollBar.horizontal: D.ScrollBar {
27+
parent: control
28+
x: control.leftPadding
29+
y: control.height - height
30+
width: control.availableWidth
31+
active: control.D.ScrollBar.vertical.active
32+
}
933
}

qt6/src/qml/TextArea.qml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ T.TextArea {
1313

1414
property D.Palette placeholderTextPalette: DS.Style.edit.placeholderText
1515
placeholderTextColor: D.ColorSelector.placeholderTextPalette
16-
implicitWidth: Math.max(DS.Style.control.implicitWidth(control), placeholder.implicitWidth + leftPadding + rightPadding)
17-
implicitHeight: Math.max(DS.Style.control.implicitHeight(control), placeholder.implicitHeight + topPadding + bottomPadding)
18-
16+
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
17+
implicitBackgroundWidth + leftInset + rightInset,
18+
placeholder.implicitWidth + leftPadding + rightPadding)
19+
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
20+
implicitBackgroundHeight + topInset + bottomInset,
21+
placeholder.implicitHeight + topPadding + bottomPadding)
22+
1923
padding: DS.Style.control.padding
2024

2125
color: palette.text

0 commit comments

Comments
 (0)