main
朱子楚\zhuzi 2023-05-15 21:14:37 +08:00
parent c095008042
commit 75193b216f
59 changed files with 80 additions and 595 deletions

View File

@ -34,7 +34,7 @@ FluScrollablePage{
{
title: '操作',
dataIndex: 'action',
width:100
width:120
},
];
table_view.columns = columns
@ -62,12 +62,14 @@ FluScrollablePage{
spacing: 10
FluFilledButton{
text:"编辑"
horizontalPadding: 6
onClicked:{
showSuccess(JSON.stringify(dataObject))
}
}
FluFilledButton{
text:"删除"
horizontalPadding: 6
onClicked:{
showError(JSON.stringify(dataObject))
}
@ -76,20 +78,6 @@ FluScrollablePage{
}
}
function loadData(page,count){
const dataSource = []
for(var i=0;i<count;i++){
dataSource.push({
name: "孙悟空%1".arg(((page-1)*count+i)),
age: 500,
address: "钟灵毓秀的花果山,如神仙仙境的水帘洞",
nickname: "齐天大圣",
action:com_action
})
}
table_view.dataSource = dataSource
}
CodeExpander{
Layout.fillWidth: true
Layout.topMargin: 10
@ -141,6 +129,17 @@ FluScrollablePage{
}'
}
function loadData(page,count){
const dataSource = []
for(var i=0;i<count;i++){
dataSource.push({
name: "孙悟空%1".arg(((page-1)*count+i)),
age: 500,
address: "钟灵毓秀的花果山,如神仙仙境的水帘洞",
nickname: "齐天大圣",
action:com_action
})
}
table_view.dataSource = dataSource
}
}

View File

@ -4,7 +4,6 @@ import FluentUI
Item {
id: control
property alias color: rect.color
property alias acrylicOpacity: rect.opacity
property alias radius:bg.radius
@ -14,7 +13,6 @@ Item {
id:bg
anchors.fill: parent
radius: [8,8,8,8]
ShaderEffectSource {
id: effect_source
anchors.fill: parent
@ -27,7 +25,6 @@ Item {
opacity: 0.5
}
}
FastBlur {
id:blur
radius: 50

View File

@ -5,7 +5,6 @@ import QtQuick.Layouts
import FluentUI
Rectangle{
property string title: ""
property string darkText : "夜间模式"
property string minimizeText : "最小化"
@ -21,32 +20,27 @@ Rectangle{
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
property bool showDark: false
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
Item{
id:d
property var win: Window.window
property bool isRestore: win && Window.Maximized === win.visibility
property bool resizable: win && !(win.minimumHeight === win.maximumHeight && win.maximumWidth === win.minimumWidth)
}
id:root
color: Qt.rgba(0,0,0,0)
visible: false
height: visible ? 30 : 0
opacity: visible
z: 65535
Item{
id:d
property var win: Window.window
property bool isRestore: win && Window.Maximized === win.visibility
property bool resizable: win && !(win.minimumHeight === win.maximumHeight && win.maximumWidth === win.minimumWidth)
}
TapHandler {
onTapped: if (tapCount === 2) toggleMaximized()
gesturePolicy: TapHandler.DragThreshold
}
DragHandler {
target: null
grabPermissions: TapHandler.CanTakeOverFromAnything
onActiveChanged: if (active) { d.win.startSystemMove(); }
}
FluText {
text: title
anchors{
@ -56,12 +50,10 @@ Rectangle{
}
color:root.textColor
}
RowLayout{
anchors.right: parent.right
height: root.height
spacing: 0
RowLayout{
Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: 5
@ -82,7 +74,6 @@ Rectangle{
}
}
}
FluIconButton{
width: 40
height: 30
@ -127,7 +118,6 @@ Rectangle{
}
}
}
function toggleMaximized() {
if(!d.resizable)
return
@ -137,5 +127,4 @@ Rectangle{
d.win.showMaximized();
}
}
}

View File

@ -4,33 +4,28 @@ import QtQuick.Window
import FluentUI
Rectangle {
default property alias content: container.data
property int paddings : 0
property int leftPadding : 0
property int rightPadding : 0
property int topPadding : 0
property int bottomPadding : 0
radius: 4
color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
border.width: 1
implicitHeight: height
implicitWidth: width
Behavior on color{
ColorAnimation {
duration: 300
}
}
Behavior on border.color{
ColorAnimation {
duration: 300
}
}
Item {
id: container
anchors.fill: parent
@ -39,5 +34,4 @@ Rectangle {
anchors.topMargin: Math.max(paddings,topPadding)
anchors.bottomMargin: Math.max(paddings,bottomPadding)
}
}

View File

@ -3,25 +3,20 @@ import QtQuick.Controls
import FluentUI
FluTextBox{
property var items:[]
property string emptyText: "没有找到结果"
property int autoSuggestBoxReplacement: FluentIcons.Search
signal itemClicked(var data)
signal handleClicked
id:control
width: 300
Component.onCompleted: {
loadData()
}
QtObject{
id:d
property bool flagVisible: true
}
Popup{
id:control_popup
y:control.height
@ -126,19 +121,16 @@ FluTextBox{
control_popup.visible = true
}
}
function handleClick(modelData){
control_popup.visible = false
control.itemClicked(modelData)
updateText(modelData.title)
}
function updateText(text){
d.flagVisible = false
control.text = text
d.flagVisible = true
}
function loadData(){
var result = []
if(items==null){
@ -152,5 +144,4 @@ FluTextBox{
})
list_view.model = result
}
}

View File

@ -3,11 +3,9 @@ import QtQuick.Controls
import FluentUI
Rectangle{
property bool isDot: false
property bool showZero: true
property int count: 0
id:control
color:Qt.rgba(255/255,77/255,79/255,1)
width: {
@ -61,7 +59,6 @@ Rectangle{
return -10
}
}
Text{
anchors.centerIn: parent
color: Qt.rgba(1,1,1,1)
@ -72,7 +69,4 @@ Rectangle{
return count+"+"
}
}
}

View File

@ -4,26 +4,21 @@ import QtQuick.Layouts
import FluentUI
Item {
property int textSize: 15
property string separator: "/"
property var items: []
property int spacing: 5
signal clickItem(var model)
id:control
implicitWidth: 300
height: 30
onItemsChanged: {
list_model.clear()
list_model.append(items)
}
ListModel{
id:list_model
}
ListView{
id:list_view
width: parent.width
@ -88,13 +83,10 @@ Item {
}
}
}
function remove(index,count){
list_model.remove(index,count)
}
function count(){
return list_model.count
}
}

View File

@ -4,12 +4,10 @@ import QtQuick.Controls.Basic
import FluentUI
Button {
property bool disabled: false
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
id: control
enabled: !disabled
focusPolicy:Qt.TabFocus

View File

@ -5,13 +5,11 @@ import QtQuick.Window
import FluentUI
Rectangle {
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property string text: "请选择日期"
property var window : Window.window
id:control
color: {
if(mouse_area.containsMouse){
@ -24,7 +22,6 @@ Rectangle {
radius: 4
border.width: 1
border.color: dividerColor
MouseArea{
id:mouse_area
hoverEnabled: true
@ -33,7 +30,6 @@ Rectangle {
popup.showPopup()
}
}
FluText{
id:text_date
anchors{
@ -47,7 +43,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
text:control.text
}
FluIcon{
iconSource: FluentIcons.Calendar
iconSize: 14
@ -58,8 +53,6 @@ Rectangle {
rightMargin: 12
}
}
Menu{
id:popup
height: container.height
@ -75,7 +68,6 @@ Rectangle {
duration: 83
}
}
exit:Transition {
NumberAnimation {
property: "opacity"
@ -84,7 +76,6 @@ Rectangle {
duration: 83
}
}
contentItem: Item{
clip: true
FluCalendarView{

View File

@ -3,27 +3,22 @@ import QtQuick.Controls
import FluentUI
Item {
enum DisplayMode {
Month,
Year,
Decade
}
property int displayMode: FluCalendarView.Month
property var date: new Date()
property var currentDate : new Date()
property var toDay: new Date()
signal dateClicked(var date)
id:control
width: 280
height: 325
Component.onCompleted: {
updateMouth(date)
}
Component{
id:com_week
Item{
@ -35,7 +30,6 @@ Item {
}
}
}
Component{
id:com_year
Button{
@ -94,7 +88,6 @@ Item {
contentItem: Item{}
}
}
Component{
id:com_month
Button{
@ -154,8 +147,6 @@ Item {
contentItem: Item{}
}
}
Component{
id:com_day
Button{
@ -189,7 +180,6 @@ Item {
}
}
}
Rectangle{
id:backgound_today
anchors.centerIn: parent
@ -201,7 +191,6 @@ Item {
border.color: FluTheme.primaryColor.dark
border.width: 1
}
Rectangle{
id:backgound_selected
anchors.centerIn: parent
@ -211,7 +200,6 @@ Item {
visible: isToDay
color: FluTheme.primaryColor.dark
}
FluText{
text:date.getDate()
anchors.centerIn: parent
@ -229,15 +217,12 @@ Item {
contentItem: Item{}
}
}
FluArea{
anchors.fill: parent
radius: 5
FluShadow{
radius: 5
}
Rectangle{
id:layout_divider
height: 1
@ -248,7 +233,6 @@ Item {
topMargin: 44
}
}
Item{
id:layout_top
anchors{
@ -257,7 +241,6 @@ Item {
top: parent.top
bottom: layout_divider.top
}
FluTextButton{
id:title
leftPadding: 0
@ -278,7 +261,6 @@ Item {
}
}
}
FluIconButton{
id:icon_up
iconSource: FluentIcons.CaretUpSolid8
@ -309,7 +291,6 @@ Item {
}
}
}
FluIconButton{
id:icon_down
iconSource: FluentIcons.CaretDownSolid8
@ -341,11 +322,9 @@ Item {
}
}
}
ListModel {
id:list_model
}
Item{
id:layout_bottom
anchors{
@ -354,7 +333,6 @@ Item {
top: layout_divider.bottom
bottom: parent.bottom
}
GridView{
model: list_model
anchors.fill: parent
@ -388,23 +366,18 @@ Item {
}
}
}
function createItemWeek(name){
return {type:0,date:new Date(),name:name,isDecade:false}
}
function createItemDay(date){
return {type:1,date:date,name:"",isDecade:false}
}
function createItemMonth(date){
return {type:2,date:date,name:"",isDecade:false}
}
function createItemYear(date,isDecade){
return {type:3,date:date,name:"",isDecade:isDecade}
}
function updateDecade(date){
list_model.clear()
var year = date.getFullYear()
@ -417,7 +390,6 @@ Item {
}
title.text = decadeStart+"-"+(decadeStart+10)
}
function updateYear(date){
list_model.clear()
var year = date.getFullYear()
@ -429,7 +401,6 @@ Item {
}
title.text = year+"年"
}
function updateMouth(date){
list_model.clear()
list_model.append([createItemWeek("一"),createItemWeek("二"),createItemWeek("三"),createItemWeek("四"),createItemWeek("五"),createItemWeek("六"),createItemWeek("日")])
@ -468,6 +439,4 @@ Item {
}
title.text = year+"年"+(month+1)+"月"
}
}

View File

@ -3,20 +3,16 @@ import QtQuick.Controls
import FluentUI
Item {
property bool flagXChanged: true
property int radius : 5
property int loopTime: 2000
property bool showIndicator: true
id:control
width: 400
height: 300
ListModel{
id:content_model
}
FluRectangle{
anchors.fill: parent
radius: [control.radius,control.radius,control.radius,control.radius]
@ -80,14 +76,6 @@ Item {
}
}
}
function setData(data){
content_model.clear()
content_model.append(data[data.length-1])
content_model.append(data)
content_model.append(data[0])
list_view.currentIndex = 1
timer_run.restart()
}
Row{
spacing: 10
anchors{
@ -133,4 +121,12 @@ Item {
timer_anim.start()
}
}
function setData(data){
content_model.clear()
content_model.append(data[data.length-1])
content_model.append(data)
content_model.append(data[0])
list_view.currentIndex = 1
timer_run.restart()
}
}

View File

@ -5,7 +5,6 @@ import QtQuick.Layouts
import FluentUI
Button {
property bool selected: false
property var clickFunc
property bool disabled: false
@ -14,7 +13,6 @@ Button {
property color borderHoverColor: FluTheme.dark ? Qt.rgba(167/255,167/255,167/255,1) : Qt.rgba(135/255,135/255,135/255,1)
property color borderDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
property color borderPressedColor: FluTheme.dark ? Qt.rgba(90/255,90/255,90/255,1) : Qt.rgba(191/255,191/255,191/255,1)
property color normalColor: FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(247/255,247/255,247/255,1)
property color selectedColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
property color hoverColor: FluTheme.dark ? Qt.rgba(72/255,72/255,72/255,1) : Qt.rgba(236/255,236/255,236/255,1)
@ -22,7 +20,6 @@ Button {
property color selectedPreesedColor: FluTheme.dark ? Qt.darker(selectedColor,1.3) : Qt.lighter(selectedColor,1.3)
property color selectedDisableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(253/255,253/255,253/255,1)
id:control
enabled: !disabled
focusPolicy:Qt.TabFocus

View File

@ -75,5 +75,4 @@ Button{
popup.open()
}
}
}

View File

@ -4,28 +4,21 @@ import FluentUI
import "ColorPicker"
Item {
property alias colorValue: color_picker.colorValue
width: color_picker.width+10
height: color_picker.height
FluArea{
anchors.fill: parent
radius: 5
FluShadow{
radius: 5
}
ColorPicker{
id:color_picker
}
}
function setColor(color) {
color_picker.setColor(color)
}
}

View File

@ -6,7 +6,6 @@ import FluentUI
Popup {
id: popup
property string title: "Title"
property string message: "Message"
property string neutralText: "Neutral"
@ -30,7 +29,6 @@ Popup {
anchors.centerIn: Overlay.overlay
closePolicy: Popup.CloseOnEscape
background:Item{}
enter: Transition {
reversible: true
NumberAnimation {
@ -58,11 +56,9 @@ Popup {
implicitHeight: text_title.height + text_message.height + layout_actions.height
color:FluTheme.dark ? 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
font: FluTextStyle.TitleLarge
@ -77,7 +73,6 @@ Popup {
right: parent.right
}
}
FluText{
id:text_message
font: FluTextStyle.Body
@ -93,7 +88,6 @@ Popup {
right: parent.right
}
}
Rectangle{
id:layout_actions
height: 68
@ -104,7 +98,6 @@ Popup {
left: parent.left
right: parent.right
}
RowLayout{
anchors
{
@ -124,7 +117,6 @@ Popup {
neutralClicked()
}
}
FluButton{
id:negative_btn
Layout.fillWidth: true
@ -136,7 +128,6 @@ Popup {
negativeClicked()
}
}
FluFilledButton{
id:positive_btn
Layout.fillWidth: true

View File

@ -5,7 +5,6 @@ import QtQuick.Controls
import FluentUI
Item {
property alias title: text_title.text
default property alias content: container.data
property int leftPadding: 0
@ -14,9 +13,7 @@ Item {
property int bottomPadding: 0
property int pageMode: FluNavigationView.Standard
property string url: ''
id:control
FluText{
id:text_title
font: FluTextStyle.TitleLarge
@ -29,7 +26,6 @@ Item {
rightMargin: control.rightPadding
}
}
Item{
clip: true
id:container
@ -43,5 +39,4 @@ Item {
bottomMargin: control.bottomPadding
}
}
}

View File

@ -3,9 +3,7 @@ import QtQuick.Controls
import FluentUI
TextField {
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
id:control
color: textColor
readOnly: true
@ -34,5 +32,4 @@ TextField {
id:menu
inputItem: control
}
}

View File

@ -5,7 +5,6 @@ import QtQuick.Window
import FluentUI
Rectangle {
property color dividerColor: FluTheme.dark ? Qt.rgba(77/255,77/255,77/255,1) : Qt.rgba(239/255,239/255,239/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color normalColor: FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(254/255,254/255,254/255,1)
@ -13,7 +12,6 @@ Rectangle {
property bool showYear: true
property bool changeFlag: true
readonly property var rowData: ["","",""]
id:root
color: {
if(mouse_area.containsMouse){
@ -26,7 +24,6 @@ Rectangle {
radius: 4
border.width: 1
border.color: dividerColor
MouseArea{
id:mouse_area
hoverEnabled: true
@ -35,7 +32,6 @@ Rectangle {
popup.showPopup()
}
}
Rectangle{
id:divider_1
width: 1
@ -44,8 +40,6 @@ Rectangle {
color: dividerColor
visible: showYear
}
Rectangle{
id:divider_2
width: 1
@ -53,7 +47,6 @@ Rectangle {
height: parent.height
color: dividerColor
}
FluText{
id:text_year
anchors{
@ -67,8 +60,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
text:"年"
}
FluText{
id:text_month
anchors{
@ -81,8 +72,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
text:"月"
}
FluText{
id:text_day
anchors{
@ -95,7 +84,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
text:"日"
}
Menu{
id:popup
modal: true
@ -111,7 +99,6 @@ Rectangle {
duration: 83
}
}
exit:Transition {
NumberAnimation {
property: "opacity"
@ -139,20 +126,16 @@ Rectangle {
FluShadow{
radius: 4
}
RowLayout{
id:layout_content
spacing: 0
width: parent.width
height: 300
Component{
id:list_delegate
Item{
height:38
width:getListView().width
function getListView(){
if(type === 0)
return list_view_1
@ -161,8 +144,6 @@ Rectangle {
if(type === 2)
return list_view_3
}
Rectangle{
anchors.fill: parent
anchors.topMargin: 2
@ -226,7 +207,6 @@ Rectangle {
}
}
}
ListView{
id:list_view_1
width: 100
@ -292,14 +272,12 @@ Rectangle {
}
}
}
Rectangle{
width: parent.width
height: 1
anchors.top: layout_content.bottom
color: dividerColor
}
Rectangle{
id:layout_actions
height: 40
@ -310,14 +288,12 @@ Rectangle {
left: parent.left
right: parent.right
}
Item {
id:divider
width: 1
height: parent.height
anchors.centerIn: parent
}
FluButton{
anchors{
left: parent.left
@ -331,7 +307,6 @@ Rectangle {
popup.close()
}
}
FluFilledButton{
anchors{
right: parent.right
@ -355,23 +330,18 @@ Rectangle {
rowData[0] = text_year.text
rowData[1] = text_month.text
rowData[2] = text_day.text
const now = new Date();
var year = text_year.text === "年"? now.getFullYear() : Number(text_year.text);
var month = text_month.text === "月"? now.getMonth() + 1 : Number(text_month.text);
var day = text_day.text === "日" ? now.getDate() : Number(text_day.text);
list_view_1.currentIndex = list_view_1.model.indexOf(year)
text_year.text = year
list_view_2.model = generateMonthArray(1,12)
list_view_2.currentIndex = list_view_2.model.indexOf(month)
text_month.text = month
list_view_3.model = generateMonthDaysArray(year,month)
list_view_3.currentIndex = list_view_3.model.indexOf(day)
text_day.text = day
var pos = root.mapToItem(null, 0, 0)
if(window.height>pos.y+root.height+container.height){
popup.y = root.height
@ -382,7 +352,6 @@ Rectangle {
}
popup.open()
}
onClosed: {
if(changeFlag){
text_year.text = rowData[0]
@ -391,7 +360,6 @@ Rectangle {
}
}
}
function generateYearArray(startYear, endYear) {
const yearArray = [];
for (let year = startYear; year <= endYear; year++) {
@ -399,7 +367,6 @@ Rectangle {
}
return yearArray;
}
function generateMonthArray(startMonth, endMonth) {
const monthArray = [];
for (let month = startMonth; month <= endMonth; month++) {
@ -407,7 +374,6 @@ Rectangle {
}
return monthArray;
}
function generateMonthDaysArray(year, month) {
const monthDaysArray = [];
const lastDayOfMonth = new Date(year, month, 0).getDate();
@ -416,6 +382,4 @@ Rectangle {
}
return monthDaysArray;
}
}

View File

@ -3,13 +3,10 @@ import QtQuick.Window
import FluentUI
Rectangle {
color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1):Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
Behavior on color{
ColorAnimation {
duration: 300
}
}
}

View File

@ -5,14 +5,12 @@ import QtQuick.Window
import FluentUI
Button {
property bool disabled: false
property color normalColor: FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(254/255,254/255,254/255,1)
property color hoverColor: FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(252/255,252/255,252/255,1)
property var window : Window.window
property alias items: menu.content
id: control
rightPadding:35
enabled: !disabled
@ -45,7 +43,6 @@ Button {
}
iconColor:title.color
}
}
contentItem: FluText {
id:title
@ -72,7 +69,6 @@ Button {
}
}
}
onClicked: {
if(items && menu.getContainerCount()!==0){
var pos = control.mapToItem(null, 0, 0)
@ -87,10 +83,8 @@ Button {
menu.open()
}
}
FluMenu{
id:menu
width: control.width
}
}

View File

@ -4,18 +4,15 @@ import QtQuick.Window
import FluentUI
Item {
property string headerText: "Titlte"
property bool expand: false
property int contentHeight : 300
default property alias content: container.data
id:root
id:control
height: layout_header.height + container.height
width: 400
implicitWidth: width
implicitHeight: height
Rectangle{
id:layout_header
width: parent.width
@ -23,28 +20,24 @@ Item {
radius: 4
color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
border.color: FluTheme.dark ? Window.active ? Qt.rgba(55/255,55/255,55/255,1) : Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,229/255,234/255,1)
Behavior on color{
ColorAnimation {
duration: 300
}
}
Behavior on border.color{
ColorAnimation {
duration: 300
}
}
MouseArea{
id:root_mouse
id:control_mouse
anchors.fill: parent
hoverEnabled: true
onClicked: {
expand = !expand
}
}
FluText{
text: headerText
anchors{
@ -53,7 +46,6 @@ Item {
leftMargin: 15
}
}
FluIconButton{
anchors{
verticalCenter: parent.verticalCenter
@ -61,7 +53,7 @@ Item {
rightMargin: 15
}
color:{
if(root_mouse.containsMouse || hovered){
if(control_mouse.containsMouse || hovered){
return FluTheme.dark ? Qt.rgba(73/255,73/255,73/255,1) : Qt.rgba(245/255,245/255,245/255,1)
}
return FluTheme.dark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
@ -81,8 +73,6 @@ Item {
}
}
}
Rectangle{
id:container
width: parent.width
@ -104,5 +94,4 @@ Item {
}
}
}
}

View File

@ -4,13 +4,11 @@ import QtQuick.Controls.Basic
import FluentUI
Button {
property bool disabled: false
property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.1) : Qt.lighter(normalColor,1.1)
property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.2) : Qt.lighter(normalColor,1.2)
id: control
enabled: !disabled
Keys.onSpacePressed: control.visualFocus&&clicked()

View File

@ -4,22 +4,18 @@ import QtQuick.Controls.Basic
import FluentUI
Item{
property bool vertical: false
default property alias content : swipe.contentData
property alias currentIndex: swipe.currentIndex
id:control
width: 400
height: 300
implicitWidth: width
implicitHeight: height
QtObject{
id:d
property bool flag: true
}
MouseArea{
anchors.fill: parent
preventStealing: true
@ -36,7 +32,6 @@ Item{
timer.restart()
}
}
Timer{
id:timer
interval: 250
@ -44,7 +39,6 @@ Item{
d.flag = true
}
}
SwipeView {
id:swipe
clip: true
@ -52,7 +46,6 @@ Item{
orientation:control.vertical ? Qt.Vertical : Qt.Horizontal
anchors.fill: parent
}
Button{
id:btn_start
height: vertical ? 20 : 40
@ -82,7 +75,6 @@ Item{
swipe.currentIndex = Math.max(swipe.currentIndex - 1, 0)
}
}
Button{
id:btn_end
height: vertical ? 20 : 40
@ -112,6 +104,4 @@ Item{
swipe.currentIndex = Math.min(swipe.currentIndex + 1,swipe.count-1)
}
}
}

View File

@ -3,9 +3,7 @@ import QtQuick.Controls
import FluentUI
Item {
property int radius: 4
id:root
anchors.fill: parent
anchors.margins: -3
@ -19,5 +17,4 @@ Item {
border.color: FluTheme.dark ? Qt.rgba(1,1,1,1) : Qt.rgba(0,0,0,1)
z: 65535
}
}

View File

@ -3,16 +3,14 @@ import QtQuick.Controls
import FluentUI
Text {
property int iconSource
property int iconSize: 20
property color iconColor: FluTheme.dark ? "#FFFFFF" : "#000000"
id:text_icon
font.family: "Segoe Fluent Icons"
font.pixelSize: iconSize
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
color: iconColor
text: (String.fromCharCode(iconSource).toString(16));
text: (String.fromCharCode(iconSource).toString(16))
}

View File

@ -4,7 +4,6 @@ import QtQuick.Controls.Basic
import FluentUI
Button {
property int iconSize: 20
property int iconSource
property bool disabled: false
@ -35,7 +34,6 @@ Button {
return Qt.rgba(0,0,0,1)
}
}
id:control
width: 30
height: 30

View File

@ -3,21 +3,17 @@ import QtQuick.Controls
import FluentUI
FluObject {
id:infoBar
property var root;
property int layoutY: 75;
property int layoutY: 75
id:control
FluObject{
id:mcontrol
property string const_success: "success";
property string const_info: "info";
property string const_warning: "warning";
property string const_error: "error";
property int maxWidth: 300;
property var screenLayout: null;
function create(type,text,duration,moremsg){
if(screenLayout){
var last = screenLayout.getLastloader();
@ -26,7 +22,6 @@ FluObject {
return;
}
}
initScreenLayout();
contentComponent.createObject(screenLayout,{
type:type,
@ -35,22 +30,19 @@ FluObject {
moremsg:moremsg,
});
}
function createCustom(itemcomponent,duration){
initScreenLayout();
if(itemcomponent){
contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
}
}
function initScreenLayout(){
if(screenLayout == null){
screenLayout = screenlayoutComponent.createObject(root);
screenLayout.y = infoBar.layoutY;
screenLayout.y = control.layoutY;
screenLayout.z = 100000;
}
}
Component{
id:screenlayoutComponent
Column{
@ -59,9 +51,7 @@ FluObject {
move: Transition {
NumberAnimation { properties: "y"; easing.type: Easing.OutBack; duration: 300 }
}
onChildrenChanged: if(children.length === 0) destroy();
function getLastloader(){
if(children.length > 0){
return children[children.length - 1];
@ -70,7 +60,6 @@ FluObject {
}
}
}
Component{
id:contentComponent
Item{
@ -80,45 +69,35 @@ FluObject {
property string type
property string text
property string moremsg
width: parent.width;
height: loader.height;
function close(){
content.destroy();
}
function restart(){
delayTimer.restart();
}
Timer {
id:delayTimer
interval: duration; running: true; repeat: true
onTriggered: content.close();
}
Loader{
id:loader;
x:(parent.width - width) / 2;
property var _super: content;
scale: item ? 1 : 0;
asynchronous: true
Behavior on scale {
NumberAnimation {
easing.type: Easing.OutBack;
duration: 100
}
}
sourceComponent:itemcomponent ? itemcomponent : mcontrol.fluent_sytle;
}
}
}
property Component fluent_sytle: Rectangle{
width: rowlayout.width + (_super.moremsg ? 25 : 80);
height: rowlayout.height + 20;
@ -208,26 +187,19 @@ FluObject {
}
}
}
function showSuccess(text,duration=1000,moremsg){
mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
}
function showInfo(text,duration=1000,moremsg){
mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
}
function showWarning(text,duration=1000,moremsg){
mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
}
function showError(text,duration=1000,moremsg){
mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
}
function showCustom(itemcomponent,duration=1000){
mcontrol.createCustom(itemcomponent,duration);
}
}

View File

@ -3,29 +3,24 @@ import QtQuick.Controls
import Qt5Compat.GraphicalEffects
Item{
id:control
property var radius:[0,0,0,0]
default property alias contentItem: container.data
id:control
Item{
id:container
width: control.width
height: control.height
opacity: 0
}
onWidthChanged: {
canvas.requestPaint()
}
onHeightChanged: {
canvas.requestPaint()
}
onRadiusChanged: {
canvas.requestPaint()
}
Canvas {
id: canvas
anchors.fill: parent
@ -55,11 +50,9 @@ Item{
ctx.restore();
}
}
OpacityMask {
anchors.fill: container
source: container
maskSource: canvas
}
}

View File

@ -4,17 +4,14 @@ import QtMultimedia
import FluentUI
Rectangle {
property url source
property bool showControl: false
property real volume: 30
id:control
width: 480
height: 270
color: FluColors.Black
clip: true
MouseArea{
anchors.fill: parent
preventStealing: true
@ -22,7 +19,6 @@ Rectangle {
showControl = !showControl
}
}
MediaPlayer {
id: mediaplayer
property bool autoSeek:true
@ -49,16 +45,13 @@ Rectangle {
}
}
}
onSourceChanged: {
slider.seek(0)
}
VideoOutput {
id:video_output
anchors.fill: parent
}
Item{
height: 100
y:showControl ? control.height - 110 : control.height
@ -110,7 +103,6 @@ Rectangle {
mediaplayer.position = val*mediaplayer.duration/slider.maxValue
}
}
FluText{
id:start_time
anchors{
@ -120,7 +112,6 @@ Rectangle {
}
text: formatDuration(slider.value*mediaplayer.duration/slider.maxValue)
}
FluText{
id:end_time
anchors{
@ -130,7 +121,6 @@ Rectangle {
}
text: formatDuration(mediaplayer.duration)
}
Row{
spacing: 10
anchors{
@ -164,7 +154,6 @@ Rectangle {
}
}
}
FluIconButton{
id:btn_volume
iconSize: 17
@ -179,7 +168,6 @@ Rectangle {
audio_output.muted = !audio_output.muted
}
}
FluSlider{
id:slider_volume
size: 80
@ -195,7 +183,6 @@ Rectangle {
}
}
}
function formatDuration(duration) {
const seconds = Math.floor(duration / 1000);
const hours = Math.floor(seconds / 3600);
@ -203,18 +190,13 @@ Rectangle {
const remainingSeconds = seconds % 60;
return `${pad(hours)}:${pad(minutes)}:${pad(remainingSeconds)}`;
}
function pad(value) {
return value.toString().padStart(2, '0');
}
function pause(){
mediaplayer.pause()
}
function play(){
mediaplayer.play()
}
}

View File

@ -4,7 +4,6 @@ import QtQuick.Controls
import FluentUI
Menu {
default property alias content: container.data
property bool enableAnimation: true
id: popup
@ -21,7 +20,6 @@ Menu {
duration: enableAnimation ? 83 : 0
}
}
exit:Transition {
NumberAnimation {
property: "opacity"
@ -30,7 +28,6 @@ Menu {
duration: enableAnimation ? 83 : 0
}
}
background:Item{
FluShadow{
radius: 5
@ -56,13 +53,10 @@ Menu {
}
}
}
function getContainerHeight(){
return container.height
}
function getContainerCount(){
return container.children.length
}
}

View File

@ -3,11 +3,9 @@ import QtQuick.Controls
import FluentUI
Item {
property string text: "MenuItem"
property var onClickFunc
signal clicked
id:control
width: {
if(control.parent){
@ -16,7 +14,6 @@ Item {
return 140
}
height: 32
Rectangle{
anchors.centerIn: parent
width: control.width-40
@ -35,12 +32,10 @@ Item {
return Qt.rgba(0,0,0,0)
}
}
FluText{
text: control.text
anchors.centerIn: parent
}
MouseArea{
id:mouse_area
hoverEnabled: true

View File

@ -4,14 +4,12 @@ import QtQuick.Controls.Basic
import FluentUI
TextArea{
property bool disabled: false
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
property color disableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
id:control
width: 300
enabled: !disabled
@ -44,5 +42,4 @@ TextArea{
id:menu
inputItem: control
}
}

View File

@ -6,14 +6,12 @@ import QtQuick.Layouts
import FluentUI
Item {
enum DisplayMode {
Open,
Compact,
Minimal,
Auto
}
property url logo
property string title: ""
property FluObject items
@ -21,15 +19,12 @@ Item {
property int displayMode: FluNavigationView.Auto
property Component autoSuggestBox
property Component actionItem
enum PageModeFlag{
Standard = 0,
SingleTop = 1,
SingleTask = 2
}
id:control
QtObject{
id:d
property bool enableStack: true
@ -52,11 +47,9 @@ Item {
property bool isCompactAndPanel: d.displayMode === FluNavigationView.Compact && d.enableNavigationPanel
property bool isCompactAndNotPanel:d.displayMode === FluNavigationView.Compact && !d.enableNavigationPanel
property bool isMinimalAndPanel: d.displayMode === FluNavigationView.Minimal && d.enableNavigationPanel
onIsCompactAndNotPanelChanged: {
collapseAll()
}
onDisplayModeChanged: {
if(d.displayMode === FluNavigationView.Compact){
collapseAll()
@ -67,7 +60,6 @@ Item {
timer_anim_x_enable.restart()
}
}
function handleItems(){
var idx = 0
var data = []
@ -103,14 +95,12 @@ Item {
return data
}
}
Component{
id:com_panel_item_empty
Item{
visible: false
}
}
Component{
id:com_panel_item_separatorr
FluDivider{
@ -130,7 +120,6 @@ Item {
}
}
}
Component{
id:com_panel_item_header
Item{
@ -159,7 +148,6 @@ Item {
}
}
}
Component{
id:com_panel_item_expander
Item{
@ -265,7 +253,6 @@ Item {
iconSize: 15
}
}
Item{
id:item_icon
width: 30
@ -314,7 +301,6 @@ Item {
}
}
}
Component{
id:com_panel_item
Item{
@ -418,7 +404,6 @@ Item {
iconSize: 15
}
}
Item{
id:item_icon
width: 30
@ -438,7 +423,6 @@ Item {
}
}
}
FluText{
id:item_title
text:model.title
@ -468,8 +452,6 @@ Item {
}
}
}
Item {
id:nav_app_bar
width: parent.width
@ -541,7 +523,6 @@ Item {
font: FluTextStyle.Body
}
}
Item{
anchors.right: parent.right
height: parent.height
@ -558,7 +539,6 @@ Item {
}
}
}
Item{
anchors{
left: d.isMinimal || d.isCompactAndPanel ? parent.left : layout_list.right
@ -597,7 +577,6 @@ Item {
replaceExit : Transition{}
}
}
MouseArea{
anchors.fill: parent
visible: d.isMinimalAndPanel||d.isCompactAndPanel
@ -605,7 +584,6 @@ Item {
d.enableNavigationPanel = false
}
}
Rectangle{
id:layout_list
width: {
@ -677,7 +655,6 @@ Item {
}
}
}
FluIconButton{
visible:opacity
opacity:d.isCompactAndNotPanel
@ -705,7 +682,6 @@ Item {
}
}
}
ListView{
id:nav_list
clip: true
@ -812,7 +788,6 @@ Item {
}
}
}
Popup{
property var childModel
id:control_popup
@ -878,7 +853,6 @@ Item {
control_popup.open()
}
}
Timer{
id:timer_anim_x_enable
interval: 150
@ -886,7 +860,6 @@ Item {
anim_layout_list_x.enabled = true
}
}
function collapseAll(){
for(var i=0;i<nav_list.model.length;i++){
var item = nav_list.model[i]
@ -895,16 +868,13 @@ Item {
}
}
}
function setCurrentIndex(index){
nav_list.currentIndex = index
}
function getItems(){
return nav_list.model
}
function push(url){
if (nav_swipe.depth>0)
{
@ -933,11 +903,9 @@ Item {
}
nav_swipe.push(url,{url:url})
}
function getCurrentIndex(){
return nav_list.currentIndex
}
function startPageByItem(data){
var items = getItems();
for(var i=0;i<items.length;i++){
@ -954,5 +922,4 @@ Item {
}
}
}
}

View File

@ -3,7 +3,6 @@ import QtQuick.Controls
import FluentUI
QtObject {
id:flu_object;
default property list<QtObject> children;
id:flu_object;
}

View File

@ -4,7 +4,6 @@ import QtQuick.Layouts
import FluentUI
Item {
id: control
signal requestPage(int page,int count)
property string previousText: "<上一页"
property string nextText: "下一页>"
@ -14,17 +13,14 @@ Item {
property int __itemPerPage: 10
property int pageButtonCount: 5
property int __pageButtonHalf: Math.floor(pageButtonCount/2)+1
id: control
implicitHeight: 40
implicitWidth: content.width
Row{
id: content
height: control.height
spacing: 10
padding: 10
FluToggleButton{
visible: control.pageCount>1
disabled: control.pageCurrent<=1
@ -33,7 +29,6 @@ Item {
control.calcNewPage(control.pageCurrent-1);
}
}
Row{
spacing: 5
FluToggleButton{
@ -93,7 +88,6 @@ Item {
}
}
}
function calcNewPage(page)
{
if(!page)
@ -104,6 +98,4 @@ Item {
control.pageCurrent=page_num
control.requestPage(page_num,control.__itemPerPage)
}
}

View File

@ -4,7 +4,6 @@ import QtQuick.Controls.Basic
import FluentUI
TextField{
property bool disabled: false
property int iconSource: 0
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
@ -12,7 +11,6 @@ TextField{
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
id:control
width: 300
enabled: !disabled
@ -74,6 +72,4 @@ TextField{
id:menu
inputItem: control
}
}

View File

@ -3,27 +3,22 @@ import QtQuick.Controls
import FluentUI
Item {
default property alias content: d.children
property alias currentIndex: nav_list.currentIndex
property color normalColor: FluTheme.dark ? FluColors.Grey120 : FluColors.Grey120
property color hoverColor: FluTheme.dark ? FluColors.Grey10 : FluColors.Black
id:control
width: 400
height: 300
implicitHeight: height
implicitWidth: width
MouseArea{
anchors.fill: parent
preventStealing: true
}
FluObject{
id:d
}
ListView{
id:nav_list
height: 40
@ -77,7 +72,6 @@ Item {
}
}
}
Item{
id:container
anchors{
@ -87,7 +81,6 @@ Item {
right: parent.right
bottom: parent.bottom
}
Repeater{
model:d.children
Loader{
@ -98,6 +91,4 @@ Item {
}
}
}
}

View File

@ -3,17 +3,14 @@ import QtQuick.Controls
import FluentUI
FluRectangle {
property real progress: 0.5
property bool indeterminate: true
id: control
width: 150
height: 5
radius: [3,3,3,3]
clip: true
color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
Component.onCompleted: {
if(indeterminate){
bar.x = -control.width*0.5
@ -23,14 +20,12 @@ FluRectangle {
bar.x = 0
}
}
Rectangle{
id:bar
radius: 3
width: control.width*progress
height: control.height
color:FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
Behavior on x{
id:behavior
enabled: false

View File

@ -3,13 +3,11 @@ import QtQuick.Controls
import FluentUI
Rectangle {
property real linWidth : width/8
property real progress: 0.25
property bool indeterminate: true
readonly property real radius2 : radius - linWidth/2
property color primaryColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
id: control
width: 44
height: 44
@ -17,25 +15,21 @@ Rectangle {
border.width: linWidth
color: "#00000000"
border.color: FluTheme.dark ? Qt.rgba(99/255,99/255,99/255,1) : Qt.rgba(214/255,214/255,214/255,1)
onProgressChanged: {
canvas.requestPaint()
}
Connections{
target: FluTheme
function onDarkChanged(){
canvas.requestPaint()
}
}
Component.onCompleted: {
if(indeterminate){
behavior.enabled = true
control.rotation = 360
}
}
Connections{
target: FluTheme
function onDarkChanged(){
canvas.requestPaint()
}
}
Behavior on rotation{
id:behavior
enabled: false
@ -53,7 +47,6 @@ Rectangle {
}
}
}
Canvas {
id:canvas
anchors.fill: parent
@ -74,6 +67,4 @@ Rectangle {
ctx.restore();
}
}
}

View File

@ -5,10 +5,8 @@ import QtQuick.Layouts
import FluentUI
Button {
property bool selected: false
property bool disabled: false
id:control
enabled: !disabled
focusPolicy:Qt.TabFocus
@ -102,4 +100,3 @@ Button {
}
}
}

View File

@ -3,22 +3,18 @@ import QtQuick.Controls
import FluentUI
Item {
property int number: 5
property int spacing: 4
property int size: 18
property int value:0
id:control
implicitWidth: container.width
implicitHeight: container.height
QtObject{
id:d
property int mouseValue: 0
property int itemSize: control.size+spacing*2
}
Row{
id:container
spacing: 0
@ -42,7 +38,6 @@ Item {
}
}
}
MouseArea{
anchors.fill: container
hoverEnabled: true
@ -56,5 +51,4 @@ Item {
control.value = Number(mouse.x / d.itemSize)+1
}
}
}

View File

@ -4,12 +4,10 @@ import Qt5Compat.GraphicalEffects
import FluentUI
Item{
property var radius:[0,0,0,0]
property color color : "#FFFFFF"
property bool shadow: true
default property alias contentItem: container.data
id:control
FluShadow{
anchors.fill: container
@ -21,7 +19,6 @@ Item{
return false
}
}
Rectangle{
id:container
width: control.width
@ -29,7 +26,6 @@ Item{
opacity: 0
color:control.color
}
Canvas {
id: canvas
anchors.fill: parent
@ -59,11 +55,9 @@ Item{
ctx.restore();
}
}
OpacityMask {
anchors.fill: container
source: container
maskSource: canvas
}
}

View File

@ -1,20 +1,17 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
ScrollBar {
property color handleNormalColor: Qt.rgba(134/255,134/255,134/255,1)
property color handleHoverColor: Qt.lighter(handleNormalColor)
property color handlePressColor: Qt.darker(handleNormalColor)
property bool expand: false
id: control
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)
visible: control.policy !== ScrollBar.AlwaysOff
minimumSize: 0.3
topPadding:{
@ -128,7 +125,6 @@ ScrollBar {
duration: 150
}
}
FluIconButton{
id:btn_top
iconSource: FluentIcons.CaretSolidUp
@ -190,5 +186,4 @@ ScrollBar {
increase()
}
}
}

View File

@ -5,7 +5,6 @@ import QtQuick.Controls
import FluentUI
Item {
property alias title: text_title.text
default property alias content: container.data
property int spacing : 0
@ -15,9 +14,7 @@ Item {
property int bottomPadding: 10
property int pageMode: FluNavigationView.Standard
property string url: ''
id:control
FluText{
id:text_title
font: FluTextStyle.Title
@ -33,7 +30,6 @@ Item {
rightMargin: control.rightPadding
}
}
Flickable{
id:flickview
clip: true

View File

@ -6,63 +6,61 @@ Item {
property color color: FluTheme.dark ? "#FFFFFF" : "#999999"
property int radius: 4
id:root
id:control
anchors.fill: parent
anchors.margins: -4
Rectangle{
width: root.width
height: root.height
width: control.width
height: control.height
anchors.centerIn: parent
color: "#00000000"
opacity: 0.02
border.width: 1
radius: root.radius
border.color: root.color
radius: control.radius
border.color: control.color
}
Rectangle{
width: root.width - 2
height: root.height - 2
width: control.width - 2
height: control.height - 2
anchors.centerIn: parent
color: "#00000000"
opacity: 0.04
border.width: 1
radius: root.radius
border.color: root.color
radius: control.radius
border.color: control.color
}
Rectangle{
width: root.width - 4
height: root.height - 4
width: control.width - 4
height: control.height - 4
anchors.centerIn: parent
color: "#00000000"
opacity: 0.06
border.width: 1
radius: root.radius
border.color: root.color
radius: control.radius
border.color: control.color
}
Rectangle{
width: root.width - 6
height: root.height - 6
width: control.width - 6
height: control.height - 6
anchors.centerIn: parent
color: "#00000000"
opacity: 0.08
border.width: 1
radius: root.radius
border.color: root.color
radius: control.radius
border.color: control.color
}
Rectangle{
width: root.width - 8
height: root.height - 8
width: control.width - 8
height: control.height - 8
anchors.centerIn: parent
opacity: 0.1
radius: root.radius
radius: control.radius
color: "#00000000"
border.width: 1
border.color: root.color
border.color: control.color
}
}

View File

@ -4,7 +4,6 @@ import Qt5Compat.GraphicalEffects
import FluentUI
Item{
property int size: 180
property int dotSize: 24
property int value: 50
@ -14,16 +13,13 @@ Item{
property var onLineClickFunc
signal pressed
signal released
id:root
height: control.height
width: control.width
rotation: vertical ? 180 : 0
Component.onCompleted: {
seek(value)
}
MouseArea{
id:mouse_line
anchors.centerIn: control
@ -45,7 +41,6 @@ Item{
}
}
}
Rectangle {
id: control
width: vertical ? 4 :size
@ -61,7 +56,6 @@ Item{
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
}
}
Rectangle{
id:dot
width: dotSize
@ -109,20 +103,17 @@ Item{
}
root.pressed()
}
onReleased: {
tool_tip.visible = false
root.released()
}
}
FluTooltip{
id:tool_tip
text:String(root.value)
y: vertical ? 32 : -40
}
}
function seek(val){
if(vertical){
dot.y =val/maxValue*control.height - dotSize/2

View File

@ -4,7 +4,6 @@ import QtQuick.Layouts
import FluentUI
Item{
enum StatusMode {
Loading,
Empty,
@ -14,13 +13,11 @@ Item{
default property alias content: container.data
property int statusMode: FluStatusView.Loading
signal errorClicked
Item{
id:container
anchors.fill: parent
visible: statusMode === FluStatusView.Success
}
FluArea{
paddings: 0
border.width: 0
@ -43,7 +40,6 @@ Item{
}
}
}
FluArea{
paddings: 0
border.width: 0
@ -63,7 +59,6 @@ Item{
}
}
}
FluArea{
paddings: 0
border.width: 0
@ -90,8 +85,6 @@ Item{
}
}
}
function showSuccessView(){
statusMode = FluStatusView.Success
}
@ -104,5 +97,4 @@ Item{
function showErrorView(){
statusMode = FluStatusView.Error
}
}

View File

@ -4,25 +4,21 @@ import QtQuick.Layouts
import FluentUI
Item {
enum TabWidthBehavior {
Equal,
SizeToContent,
Compact
}
enum CloseButtonVisibility{
Nerver,
Always,
OnHover
}
property int tabWidthBehavior : FluTabView.Equal
property int closeButtonVisibility : FluTabView.Always
property int itemWidth: 146
property bool addButtonVisibility: true
signal newPressed
id:control
implicitHeight: height
implicitWidth: width
@ -31,7 +27,6 @@ Item {
return parent
return undefined
}
QtObject {
id: d
property int dragIndex: -1
@ -39,16 +34,13 @@ Item {
property bool itemPress: false
property int maxEqualWidth: 240
}
MouseArea{
anchors.fill: parent
preventStealing: true
}
ListModel{
id:tab_model
}
FluIconButton{
id:btn_new
visible: addButtonVisibility
@ -61,7 +53,6 @@ Item {
newPressed()
}
}
ListView{
id:tab_nav
height: 34
@ -88,21 +79,16 @@ Item {
policy: ScrollBar.AlwaysOff
}
delegate: Item{
width: item_layout.width
height: item_container.height
z: item_mouse_drag.pressed ? 1000 : 1
Item{
id:item_layout
width: item_container.width
height: item_container.height
FluItem{
id:item_container
property real timestamp: new Date().getTime()
height: tab_nav.height
width: {
if(tabWidthBehavior === FluTabView.Equal){
@ -119,24 +105,20 @@ Item {
radius: [6,6,0,0]
Behavior on x { enabled: d.dragBehavior; NumberAnimation { duration: 200 } }
Behavior on y { enabled: d.dragBehavior; NumberAnimation { duration: 200 } }
MouseArea{
id:item_mouse_hove
anchors.fill: parent
hoverEnabled: true
}
MouseArea{
id:item_mouse_drag
anchors.fill: parent
drag.target: item_container
drag.axis: Drag.XAxis
onWheel: (wheel)=>{
if (wheel.angleDelta.y > 0) scroll_nav.decrease()
else scroll_nav.increase()
}
onPressed: {
d.itemPress = true
item_container.timestamp = new Date().getTime();
@ -147,7 +129,6 @@ Item {
item_container.x = pos.x
item_container.y = pos.y
}
onReleased: {
d.itemPress = false
timer.stop()
@ -164,7 +145,6 @@ Item {
item_container.x = 0;
item_container.y = 0;
}
onPositionChanged: {
var pos = tab_nav.mapFromItem(item_container, 0, 0)
updatePosition(pos)
@ -211,7 +191,6 @@ Item {
}
}
}
Rectangle{
anchors.fill: parent
color: {
@ -234,7 +213,6 @@ Item {
}
}
}
RowLayout{
spacing: 0
height: parent.height
@ -271,7 +249,6 @@ Item {
}
}
}
FluIconButton{
id:item_btn_close
iconSource: FluentIcons.ChromeClose
@ -294,7 +271,6 @@ Item {
tab_model.remove(index)
}
}
FluDivider{
width: 1
height: 16
@ -307,8 +283,6 @@ Item {
}
}
}
Item{
id:container
anchors{
@ -317,7 +291,6 @@ Item {
right: parent.right
bottom: parent.bottom
}
Repeater{
model:tab_model
Loader{
@ -328,23 +301,17 @@ Item {
}
}
}
function createTab(icon,text,page,argument={}){
return {icon:icon,text:text,page:page,argument:argument}
}
function appendTab(icon,text,page,argument){
tab_model.append(createTab(icon,text,page,argument))
}
function setTabList(list){
tab_model.clear()
tab_model.append(list)
}
function count(){
return tab_nav.count
}
}

View File

@ -5,7 +5,6 @@ import QtQuick.Layouts
import FluentUI
Item {
property var columns : []
property var dataSource : []
property int pageCurrent: 1
@ -14,28 +13,22 @@ Item {
property int itemHeight: 56
property bool pageVisible: true
signal requestPage(int page,int count)
id:control
implicitHeight: layout_table.height
QtObject{
id:d
property int coumnsWidth: parent.width
}
MouseArea{
anchors.fill: parent
preventStealing: true
}
ListModel{
id:model_coumns
}
ListModel{
id:model_data_source
}
onColumnsChanged: {
model_coumns.clear()
model_coumns.append(columns)
@ -46,12 +39,10 @@ Item {
}
d.coumnsWidth = w
}
onDataSourceChanged: {
model_data_source.clear()
model_data_source.append(dataSource)
}
Flickable{
id:layout_flickable
height: layout_table.height
@ -75,14 +66,12 @@ Item {
width: Math.max(layout_flickable.width,d.coumnsWidth)
clip:true
interactive: false
header: FluRectangle{
id:layout_coumns
height: control.itemHeight
width: parent.width
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
radius: [5,5,0,0]
Row{
id:list_coumns
spacing: 0
@ -113,7 +102,6 @@ Item {
}
}
}
footer: Item{
height: pageVisible ? 50 : 0
clip: true
@ -201,8 +189,6 @@ Item {
}
}
}
Component{
id:com_text
Item{
@ -232,11 +218,9 @@ Item {
}
}
}
function getObject(index){
return model_data_source.get(index)
}
function getObjectValues(index) {
var obj = model_data_source.get(index)
if(!obj)
@ -248,5 +232,4 @@ Item {
}
return data;
}
}

View File

@ -3,12 +3,9 @@ import QtQuick.Controls
import FluentUI
Text {
property color textColor: FluTheme.dark ? FluColors.White : FluColors.Grey220
id:text
color: textColor
renderType: FluTheme.nativeText ? Text.NativeRendering : Text.QtRendering
font: FluTextStyle.Body
}

View File

@ -4,7 +4,6 @@ import QtQuick.Controls.Basic
import FluentUI
TextField{
property bool disabled: false
property int iconSource: 0
property color normalColor: FluTheme.dark ? Qt.rgba(255/255,255/255,255/255,1) : Qt.rgba(27/255,27/255,27/255,1)
@ -12,7 +11,6 @@ TextField{
property color placeholderNormalColor: FluTheme.dark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
property color placeholderFocusColor: FluTheme.dark ? Qt.rgba(152/255,152/255,152/255,1) : Qt.rgba(141/255,141/255,141/255,1)
property color placeholderDisableColor: FluTheme.dark ? Qt.rgba(131/255,131/255,131/255,1) : Qt.rgba(160/255,160/255,160/255,1)
id:control
width: 300
enabled: !disabled

View File

@ -4,9 +4,7 @@ import Qt5Compat.GraphicalEffects
import FluentUI
Rectangle{
property Item inputItem
id:content
radius: 4
layer.enabled: true

View File

@ -3,30 +3,25 @@ import QtQuick.Controls
import FluentUI
FluMenu{
property string cutText : "剪切"
property string copyText : "复制"
property string pasteText : "粘贴"
property string selectAllText : "全选"
property var inputItem
id:menu
focus:false
enableAnimation:false
onVisibleChanged: {
if(visible){
inputItem.forceActiveFocus()
}
}
Connections{
target: inputItem
function onTextChanged() {
menu.close()
}
}
FluMenuItem{
text: cutText
visible: inputItem.selectedText !== "" && !inputItem.readOnly
@ -34,7 +29,6 @@ FluMenu{
inputItem.cut()
}
}
FluMenuItem{
text: copyText
visible: inputItem.selectedText !== ""

View File

@ -4,14 +4,12 @@ import QtQuick.Controls.Basic
import FluentUI
Button {
property bool disabled: false
property color normalColor: FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
property color hoverColor: FluTheme.dark ? Qt.darker(normalColor,1.15) : Qt.lighter(normalColor,1.15)
property color pressedColor: FluTheme.dark ? Qt.darker(normalColor,1.3) : Qt.lighter(normalColor,1.3)
property color disableColor: FluTheme.dark ? Qt.rgba(82/255,82/255,82/255,1) : Qt.rgba(199/255,199/255,199/255,1)
property bool textBold: true
id: control
topPadding:0
bottomPadding:0
@ -19,9 +17,7 @@ Button {
rightPadding:0
enabled: !disabled
focusPolicy:Qt.TabFocus
Keys.onSpacePressed: control.visualFocus&&clicked()
background: Item{
FluFocusRectangle{
visible: control.visualFocus

View File

@ -38,7 +38,6 @@ Rectangle {
popup.showPopup()
}
}
Rectangle{
id:divider_1
width: 1
@ -46,8 +45,6 @@ Rectangle {
height: parent.height
color: dividerColor
}
Rectangle{
id:divider_2
width: 1
@ -56,7 +53,6 @@ Rectangle {
color: dividerColor
visible: isH
}
FluText{
id:text_hour
anchors{
@ -69,8 +65,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
text:"时"
}
FluText{
id:text_minute
anchors{
@ -83,8 +77,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
text:"分"
}
FluText{
id:text_ampm
visible: isH
@ -98,7 +90,6 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
text:"AM/PM"
}
Menu{
id:popup
width: container.width
@ -114,7 +105,6 @@ Rectangle {
duration: 83
}
}
exit:Transition {
NumberAnimation {
property: "opacity"
@ -144,14 +134,11 @@ Rectangle {
spacing: 0
width: parent.width
height: 300
Component{
id:list_delegate
Item{
height:38
width:getListView().width
function getListView(){
if(type === 0)
return list_view_1
@ -160,8 +147,6 @@ Rectangle {
if(type === 2)
return list_view_3
}
Rectangle{
anchors.fill: parent
anchors.topMargin: 2
@ -217,7 +202,6 @@ Rectangle {
}
}
}
ListView{
id:list_view_1
width: isH ? 100 : 150
@ -286,14 +270,12 @@ Rectangle {
}
}
}
Rectangle{
width: parent.width
height: 1
anchors.top: layout_content.bottom
color: dividerColor
}
Rectangle{
id:layout_actions
height: 40
@ -304,14 +286,12 @@ Rectangle {
left: parent.left
right: parent.right
}
Item {
id:divider
width: 1
height: parent.height
anchors.centerIn: parent
}
FluButton{
anchors{
left: parent.left
@ -325,7 +305,6 @@ Rectangle {
popup.close()
}
}
FluFilledButton{
anchors{
right: parent.right
@ -388,7 +367,6 @@ Rectangle {
}
popup.open()
}
onClosed: {
if(changeFlag){
text_hour.text = rowData[0]
@ -396,13 +374,9 @@ Rectangle {
text_ampm.text = rowData[2]
}
}
}
property bool changeFlag: true
readonly property var rowData: ["","",""]
function generateArray(start, n) {
var arr = [];
for (var i = start; i <= n; i++) {
@ -410,5 +384,4 @@ Rectangle {
}
return arr;
}
}

View File

@ -21,9 +21,7 @@ Button {
}
selected = !selected
}
contentItem: Item{}
background : RowLayout{
spacing: 0
Rectangle {

View File

@ -3,18 +3,12 @@ import QtQuick.Controls
import FluentUI
ToolTip {
id:tool_tip
// property var font: FluTextStyle.Body
contentItem: FluText {
text: tool_tip.text
// font: tool_tip.font
padding: 4
wrapMode: Text.WrapAnywhere
}
background: Rectangle{
anchors.fill: parent
color: FluTheme.dark ? Qt.rgba(50/255,49/255,48/255,1) : Qt.rgba(1,1,1,1)

View File

@ -5,19 +5,16 @@ import QtQuick.Controls
import FluentUI
Item {
enum TreeViewSelectionMode {
None,
Single,
Multiple
}
property int selectionMode: FluTreeView.None
property var currentElement
property var currentParentElement
property var rootModel: tree_model.get(0).items
signal itemClicked(var item)
id:root
ListModel{
id:tree_model
@ -31,7 +28,6 @@ Item {
multipParentKey:""
}
}
Component{
id: delegate_root
Column{
@ -54,13 +50,10 @@ Item {
}
}
}
Component{
id:delegate_items
Column{
id:item_layout
property real level: (mapToItem(list_root,0,0).x+list_root.contentX)/0.001
property var text: model.text??"Item"
property bool hasChild : (model.items !== undefined) && (model.items.count !== 0)
@ -69,7 +62,6 @@ Item {
property int width_hint: calculateWidth()
property bool singleSelected: currentElement === model
property var itemModel: model
function calculateWidth(){
var w = Math.max(list_root.width, item_layout_row.implicitWidth + 10);
if(expanded){
@ -86,8 +78,6 @@ Item {
id:item_layout_rect
width: list_root.contentWidth
height: item_layout_row.implicitHeight
Rectangle{
anchors.fill: parent
anchors.margins: 2
@ -104,7 +94,6 @@ Item {
return (item_layout_mouse.containsMouse || item_layout_expanded.hovered || item_layout_checkbox.hovered)?Qt.rgba(0,0,0,0.03):Qt.rgba(0,0,0,0)
}
}
Rectangle{
width: 3
color:FluTheme.primaryColor.dark
@ -126,8 +115,6 @@ Item {
}
}
}
function onClickItem(){
if(selectionMode === FluTreeView.None){
itemClicked(model)
@ -147,23 +134,19 @@ Item {
}
}
RowLayout{
id:item_layout_row
anchors.verticalCenter: item_layout_rect.verticalCenter
Item{
width: 15*level
Layout.alignment: Qt.AlignVCenter
}
FluCheckBox{
id:item_layout_checkbox
text:""
selected: itemModel.multipSelected
visible: selectionMode === FluTreeView.Multiple
Layout.leftMargin: 5
function refreshCheckBox(){
const stack = [tree_model.get(0)];
const result = [];
@ -195,7 +178,6 @@ Item {
}
}
}
clickFunc:function(){
if(hasChild){
const stack = [itemModel];
@ -215,7 +197,6 @@ Item {
}
}
}
FluIconButton{
id:item_layout_expanded
color:"#00000000"
@ -230,7 +211,6 @@ Item {
model.expanded = !model.expanded
}
}
FluText {
text: item_layout.text
Layout.alignment: Qt.AlignVCenter
@ -239,7 +219,6 @@ Item {
}
}
}
Item{
id:item_sub
visible: {
@ -263,7 +242,6 @@ Item {
}
}
}
ListView {
id: list_root
anchors.fill: parent
@ -275,16 +253,13 @@ Item {
ScrollBar.vertical: FluScrollBar {}
ScrollBar.horizontal: FluScrollBar { }
}
function updateData(items){
rootModel.clear()
rootModel.append(items)
}
function signleData(){
return currentElement
}
function multipData(){
const stack = [tree_model.get(0)];
const result = [];
@ -300,11 +275,9 @@ Item {
}
return result
}
function createItem(text="",expanded=true,items=[],data={}){
return {text:text,expanded:expanded,items:items,key:uniqueRandom(),multipSelected:false,multipIndex:0,multipParentKey:"",data:data};
}
function uniqueRandom() {
var timestamp = Date.now();
var random = Math.floor(Math.random() * 1000000);

View File

@ -5,13 +5,11 @@ import QtQuick.Layouts
import FluentUI
Window {
enum LaunchMode {
Standard,
SingleTask,
SingleInstance
}
default property alias content: container.data
property bool closeDestory: true
property int launchMode: FluWindow.Standard
@ -26,70 +24,58 @@ Window {
event.accepted = false
}
}
signal initArgument(var argument)
id:window
Rectangle{
anchors.fill: parent
color: {
property color backgroundColor: {
if(active){
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1)
}
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
}
signal initArgument(var argument)
id:window
onClosing:(event)=>closeFunc(event)
Component.onCompleted: {
helper.initWindow(window)
initArgument(argument)
}
Rectangle{
anchors.fill: parent
color: backgroundColor
Behavior on color{
ColorAnimation {
duration: 300
}
}
}
Item{
id:container
anchors.fill: parent
clip: true
}
onClosing:(event)=>closeFunc(event)
FluInfoBar{
id:infoBar
root: window
}
WindowHelper{
id:helper
}
Component.onCompleted: {
helper.initWindow(window)
initArgument(argument)
}
function showSuccess(text,duration,moremsg){
infoBar.showSuccess(text,duration,moremsg);
}
function showInfo(text,duration,moremsg){
infoBar.showInfo(text,duration,moremsg);
}
function showWarning(text,duration,moremsg){
infoBar.showWarning(text,duration,moremsg);
}
function showError(text,duration,moremsg){
infoBar.showError(text,duration,moremsg);
}
function registerForWindowResult(path){
return helper.createRegister(window,path)
}
function deleteWindow(){
helper.deleteWindow()
}
function onResult(data){
if(pageRegister){
pageRegister.onResult(data)