forked from linuxdeepin/dtkdeclarative
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ControlGroup Log:
- Loading branch information
wangfei
committed
Jul 18, 2024
1 parent
a6ccd0f
commit 950b811
Showing
5 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
import QtQuick 2.0 | ||
import QtQuick.Window 2.11 | ||
import QtQuick.Layouts 1.11 | ||
import org.deepin.dtk 1.0 | ||
import ".." | ||
|
||
ControlGroup { | ||
Label { | ||
visible: true | ||
text: "test0111111111111" | ||
} | ||
Label { | ||
visible: true | ||
text: "test13333333333" | ||
} | ||
Rectangle { | ||
width: 100 | ||
height: 100 | ||
color: "red" | ||
border.color: "black" | ||
border.width: 5 | ||
radius: 10 | ||
} | ||
Switch { | ||
checked: true | ||
Layout.alignment: Qt.AlignHCenter | ||
} | ||
ListView { | ||
id: popupListView | ||
height: contentHeight | ||
width: 100 | ||
model: ListModel { | ||
ListElement { type: 1; icon: "music"; text: "1小时"} | ||
ListElement { type: 2; icon: "music"; text: "直至今晚"} | ||
ListElement { type: 3; icon: "music"; text: "直至明早"} | ||
ListElement { type: 4; icon: "music"; text: "保持开启"} | ||
} | ||
delegate: ItemDelegate { | ||
width: 80 | ||
icon.name: model.icon | ||
text: model.text | ||
checked: index === 1 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
|
||
import QtQuick 2.0 | ||
import QtQuick.Layouts 1.11 | ||
import QtQml.Models 2.11 | ||
import org.deepin.dtk 1.0 | ||
|
||
ColumnLayout { | ||
width: 280 | ||
property string title | ||
default property alias content: itemModel.children | ||
clip: true | ||
height: titleBar.height + info.height | ||
Layout.fillHeight: true | ||
|
||
ItemDelegate { | ||
id: titleBar | ||
Layout.fillWidth: true; Layout.preferredHeight: 36 | ||
text: title | ||
icon.name: info.isExpanded ? "go-up": "go-down" | ||
display: IconLabel.IconBesideText | ||
checkable: false | ||
font: DTK.fontManager.t5 | ||
backgroundVisible: hovered | ||
MouseArea { | ||
anchors.fill: parent | ||
onClicked: { | ||
info.y = -30 | ||
info.isExpanded = !info.isExpanded | ||
console.log("1111111", info.y, info.height) | ||
} | ||
} | ||
} | ||
ListView { | ||
id: info | ||
y: isExpanded ? titleBar.height : - height | ||
opacity: isExpanded ? 1.0 : 0.0 | ||
Layout.fillWidth: true | ||
Layout.preferredHeight: contentHeight | ||
property bool isExpanded: true | ||
height: contentHeight | ||
spacing: 5 | ||
model: ObjectModel { | ||
id: itemModel | ||
} | ||
Component.onCompleted: { | ||
for (var i = 0; i < count; ++i) { | ||
var item = model.get(i) | ||
item.width = width | ||
} | ||
} | ||
Behavior on y { | ||
NumberAnimation { | ||
duration: 1000 | ||
easing.type: Easing.InOutQuad | ||
} | ||
} | ||
Behavior on opacity { | ||
NumberAnimation { | ||
duration: 1000 | ||
easing.type: Easing.InOutQuad | ||
} | ||
} | ||
} | ||
} |