mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-02 16:15:28 +08:00
update
This commit is contained in:
@ -11,7 +11,7 @@ Rectangle{
|
||||
color: {
|
||||
if(Window.window == null)
|
||||
return borerlessColor
|
||||
return Window.window.active ? borerlessColor : Qt.lighter(FluTheme.primaryColor.lightest,1.1)
|
||||
return Window.window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
}
|
||||
height: 50
|
||||
width: {
|
||||
|
@ -1,19 +1,115 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Window 2.15
|
||||
|
||||
Popup {
|
||||
id: popup
|
||||
default property alias content: container.data
|
||||
|
||||
property string title: "Title"
|
||||
property string message: "Messaeg"
|
||||
property string negativeText: "Negative"
|
||||
property string positiveText: "Positive"
|
||||
signal negativeClicked
|
||||
signal positiveClicked
|
||||
|
||||
property var minWidth: {
|
||||
if(Window.window==null)
|
||||
return 400
|
||||
return Math.min(Window.window.width,400)
|
||||
}
|
||||
|
||||
modal:true
|
||||
anchors.centerIn: Overlay.overlay
|
||||
closePolicy: Popup.CloseOnEscape
|
||||
background: Rectangle {
|
||||
implicitWidth: 140
|
||||
implicitHeight: container.height
|
||||
color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(237/255,237/255,237/255,1)
|
||||
radius: 5
|
||||
implicitWidth:minWidth
|
||||
implicitHeight: text_title.height + text_message.height + layout_actions.height
|
||||
color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(249/255,249/255,249/255,1)
|
||||
radius:5
|
||||
FluShadow{
|
||||
radius: 5
|
||||
}
|
||||
|
||||
FluText{
|
||||
id:text_title
|
||||
fontStyle: FluText.TitleLarge
|
||||
text:title
|
||||
topPadding: 20
|
||||
leftPadding: 20
|
||||
rightPadding: 20
|
||||
wrapMode: Text.WrapAnywhere
|
||||
anchors{
|
||||
top:parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
id:text_message
|
||||
fontStyle: FluText.Body
|
||||
wrapMode: Text.WrapAnywhere
|
||||
text:message
|
||||
topPadding: 14
|
||||
leftPadding: 20
|
||||
rightPadding: 20
|
||||
bottomPadding: 14
|
||||
anchors{
|
||||
top:text_title.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:layout_actions
|
||||
height: 68
|
||||
radius: 5
|
||||
color: FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
anchors{
|
||||
top:text_message.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
Item {
|
||||
id:divider
|
||||
width: 1
|
||||
height: parent.height
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
|
||||
FluButton{
|
||||
anchors{
|
||||
left: parent.left
|
||||
leftMargin: 20
|
||||
rightMargin: 10
|
||||
right: divider.left
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: negativeText
|
||||
onClicked: {
|
||||
popup.close()
|
||||
negativeClicked()
|
||||
}
|
||||
}
|
||||
|
||||
FluFilledButton{
|
||||
anchors{
|
||||
right: parent.right
|
||||
left: divider.right
|
||||
rightMargin: 20
|
||||
leftMargin: 10
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: positiveText
|
||||
onClicked: {
|
||||
popup.close()
|
||||
positiveClicked()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6
src/controls/FluTreeItem.qml
Normal file
6
src/controls/FluTreeItem.qml
Normal file
@ -0,0 +1,6 @@
|
||||
import QtQuick 2.15
|
||||
|
||||
QtObject {
|
||||
property string text;
|
||||
property list<FluTreeItem> items;
|
||||
}
|
52
src/controls/FluTreeView.qml
Normal file
52
src/controls/FluTreeView.qml
Normal file
@ -0,0 +1,52 @@
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Window 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
import FluentUI 1.0
|
||||
import QtGraphicalEffects 1.15
|
||||
|
||||
Rectangle {
|
||||
id:root
|
||||
color:"#eeeeee"
|
||||
|
||||
ListModel{
|
||||
id:list_model
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: list_root
|
||||
anchors.fill: parent
|
||||
|
||||
delegate: Rectangle{
|
||||
width: list_root.width
|
||||
height: 40
|
||||
FluText{
|
||||
anchors.centerIn: parent
|
||||
text:model.text
|
||||
}
|
||||
}
|
||||
model:list_model
|
||||
clip: true
|
||||
}
|
||||
|
||||
|
||||
function addItems(items:list<FluTreeItem>){
|
||||
items.map(item=>{
|
||||
list_model.append({"text":item.text})
|
||||
console.debug(item.text)
|
||||
})
|
||||
}
|
||||
|
||||
function createItem(text){
|
||||
var com = Qt.createComponent("FluTreeItem.qml")
|
||||
return com.createObject(root,{text:text})
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
addItems([createItem("item1"),createItem("item2")])
|
||||
// var data=[{"text":"item1"},{"text":"item1"}]
|
||||
// list_model.append(data)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -46,7 +46,7 @@ Item {
|
||||
color: {
|
||||
if(window === null)
|
||||
return borerlessColor
|
||||
return window.active ? borerlessColor : Qt.lighter(FluTheme.primaryColor.lightest,1.1)
|
||||
return window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
}
|
||||
border.width: 1
|
||||
anchors.fill: parent
|
||||
|
Reference in New Issue
Block a user