mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-02 08:05:29 +08:00
Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
a574cd9230 | |||
8c45c125e6 | |||
aab4802d7e | |||
441c1ab03c | |||
91f4f508cc | |||
94f8047508 | |||
d926a84f72 | |||
c07011408c | |||
4f9ec6abf2 | |||
c3b3dc904e | |||
2a5acb45a1 | |||
d29580f8f2 | |||
fd0ddbf5aa | |||
ac602c5afa | |||
8dbfcfd994 | |||
c5ce34cbc3 |
2
.github/workflows/windows.yml
vendored
2
.github/workflows/windows.yml
vendored
@ -23,7 +23,7 @@ jobs:
|
||||
matrix:
|
||||
os: [windows-2019]
|
||||
include:
|
||||
- qt_ver: 6.5.0
|
||||
- qt_ver: 6.5.0
|
||||
qt_arch: win64_msvc2019_64
|
||||
msvc_arch: x64
|
||||
qt_arch_install: msvc2019_64
|
||||
|
@ -20,7 +20,7 @@ endif()
|
||||
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
|
||||
|
||||
#设置版本号
|
||||
add_definitions(-DVERSION=1,3,3,0)
|
||||
add_definitions(-DVERSION=1,3,4,0)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED)
|
||||
|
||||
|
@ -13,7 +13,6 @@ Window {
|
||||
"/":"qrc:/example/qml/window/MainWindow.qml",
|
||||
"/about":"qrc:/example/qml/window/AboutWindow.qml",
|
||||
"/login":"qrc:/example/qml/window/LoginWindow.qml",
|
||||
"/media":"qrc:/example/qml/window/MediaWindow.qml",
|
||||
"/singleTaskWindow":"qrc:/example/qml/window/SingleTaskWindow.qml",
|
||||
"/standardWindow":"qrc:/example/qml/window/StandardWindow.qml",
|
||||
"/singleInstanceWindow":"qrc:/example/qml/window/SingleInstanceWindow.qml"
|
||||
|
@ -8,16 +8,17 @@ FluObject{
|
||||
property var navigationView
|
||||
|
||||
FluPaneItem{
|
||||
id:item_home
|
||||
count: 9
|
||||
title:lang.home
|
||||
infoBadge:FluBadge{
|
||||
count: item_home.count
|
||||
}
|
||||
icon:FluentIcons.Home
|
||||
// cusIcon: Image{
|
||||
// anchors.centerIn: parent
|
||||
// source: FluTheme.dark ? "qrc:/example/res/svg/home_dark.svg" : "qrc:/example/res/svg/home.svg"
|
||||
// sourceSize: Qt.size(30,30)
|
||||
// width: 18
|
||||
// height: 18
|
||||
// }
|
||||
onTap:{
|
||||
if(navigationView.getCurrentUrl()){
|
||||
item_home.count = 0
|
||||
}
|
||||
navigationView.push("qrc:/example/qml/page/T_Home.qml")
|
||||
}
|
||||
}
|
||||
@ -26,17 +27,30 @@ FluObject{
|
||||
title:lang.basic_input
|
||||
icon:FluentIcons.CheckboxComposite
|
||||
FluPaneItem{
|
||||
id:item_buttons
|
||||
count: 99
|
||||
infoBadge:FluBadge{
|
||||
count: item_buttons.count
|
||||
}
|
||||
title:"Buttons"
|
||||
image:"qrc:/example/res/image/control/Button.png"
|
||||
recentlyUpdated:true
|
||||
desc:"A control that responds to user input and raisesa Click event."
|
||||
onTap:{
|
||||
item_buttons.count = 0
|
||||
navigationView.push("qrc:/example/qml/page/T_Buttons.qml")
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
id:item_text
|
||||
title:"Text"
|
||||
count: 5
|
||||
infoBadge:FluBadge{
|
||||
count: item_text.count
|
||||
color: Qt.rgba(82/255,196/255,26/255,1)
|
||||
}
|
||||
onTap:{
|
||||
item_text.count = 0
|
||||
navigationView.push("qrc:/example/qml/page/T_Text.qml")
|
||||
}
|
||||
}
|
||||
@ -167,8 +181,15 @@ FluObject{
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
id:item_combobox
|
||||
title:"ComboBox"
|
||||
count: 9
|
||||
infoBadge:FluBadge{
|
||||
count: item_combobox.count
|
||||
color: Qt.rgba(250/255,173/255,20/255,1)
|
||||
}
|
||||
onTap:{
|
||||
item_combobox.count = 0
|
||||
navigationView.push("qrc:/example/qml/page/T_ComboBox.qml")
|
||||
}
|
||||
}
|
||||
@ -231,6 +252,12 @@ FluObject{
|
||||
navigationView.push("qrc:/example/qml/page/T_TableView.qml")
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"TableView2"
|
||||
onTap:{
|
||||
navigationView.push("qrc:/example/qml/page/T_TableView2.qml")
|
||||
}
|
||||
}
|
||||
FluPaneItem{
|
||||
title:"MultiWindow"
|
||||
onTap:{
|
||||
@ -278,28 +305,19 @@ FluObject{
|
||||
}
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:lang.media
|
||||
icon:FluentIcons.Media
|
||||
FluPaneItem{
|
||||
title:"MediaPlayer"
|
||||
image:"qrc:/example/res/image/control/MediaPlayerElement.png"
|
||||
recentlyAdded:true
|
||||
order:0
|
||||
desc:"A control to display video and image content."
|
||||
onTap:{
|
||||
navigationView.push("qrc:/example/qml/page/T_MediaPlayer.qml")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FluPaneItemExpander{
|
||||
title:lang.other
|
||||
icon:FluentIcons.Shop
|
||||
FluPaneItem{
|
||||
id:item_other
|
||||
title:"RemoteLoader"
|
||||
count: 99
|
||||
infoBadge:FluBadge{
|
||||
count: item_other.count
|
||||
color: Qt.rgba(82/255,196/255,26/255,1)
|
||||
}
|
||||
onTap:{
|
||||
item_other.count = 0
|
||||
navigationView.push("qrc:/example/qml/page/T_RemoteLoader.qml")
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ FluScrollablePage{
|
||||
radius: 8
|
||||
color: Qt.rgba(191/255,191/255,191/255,1)
|
||||
FluBadge{
|
||||
topRight: true
|
||||
showZero: true
|
||||
count:0
|
||||
}
|
||||
}
|
||||
@ -43,6 +45,8 @@ FluScrollablePage{
|
||||
radius: 8
|
||||
color: Qt.rgba(191/255,191/255,191/255,1)
|
||||
FluBadge{
|
||||
topRight: true
|
||||
showZero: true
|
||||
count:5
|
||||
}
|
||||
}
|
||||
@ -52,6 +56,8 @@ FluScrollablePage{
|
||||
radius: 8
|
||||
color: Qt.rgba(191/255,191/255,191/255,1)
|
||||
FluBadge{
|
||||
topRight: true
|
||||
showZero: true
|
||||
count:50
|
||||
}
|
||||
}
|
||||
@ -61,6 +67,8 @@ FluScrollablePage{
|
||||
radius: 8
|
||||
color: Qt.rgba(191/255,191/255,191/255,1)
|
||||
FluBadge{
|
||||
topRight: true
|
||||
showZero: true
|
||||
count:100
|
||||
}
|
||||
}
|
||||
@ -70,6 +78,8 @@ FluScrollablePage{
|
||||
radius: 8
|
||||
color: Qt.rgba(191/255,191/255,191/255,1)
|
||||
FluBadge{
|
||||
topRight: true
|
||||
showZero: true
|
||||
isDot:true
|
||||
}
|
||||
}
|
||||
@ -79,6 +89,8 @@ FluScrollablePage{
|
||||
radius: 8
|
||||
color: Qt.rgba(191/255,191/255,191/255,1)
|
||||
FluBadge{
|
||||
topRight: true
|
||||
showZero: true
|
||||
count:99
|
||||
color: Qt.rgba(250/255,173/255,20/255,1)
|
||||
}
|
||||
@ -89,6 +101,8 @@ FluScrollablePage{
|
||||
radius: 8
|
||||
color: Qt.rgba(191/255,191/255,191/255,1)
|
||||
FluBadge{
|
||||
topRight: true
|
||||
showZero: true
|
||||
count:99
|
||||
color: Qt.rgba(82/255,196/255,26/255,1)
|
||||
}
|
||||
|
@ -28,10 +28,6 @@ FluScrollablePage{
|
||||
ListElement { text: "Apple" }
|
||||
ListElement { text: "Coconut" }
|
||||
}
|
||||
onAccepted: {
|
||||
if (find(editText) === -1)
|
||||
model_1.append({text: editText})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,62 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Window
|
||||
import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
FluScrollablePage{
|
||||
|
||||
title:"MediaPlayer"
|
||||
|
||||
onVisibleChanged: {
|
||||
if(visible){
|
||||
player.play()
|
||||
}else{
|
||||
player.pause()
|
||||
}
|
||||
}
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 320
|
||||
Layout.topMargin: 20
|
||||
paddings: 10
|
||||
ColumnLayout{
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left:parent.left
|
||||
}
|
||||
FluMediaPlayer{
|
||||
id:player
|
||||
source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
||||
}
|
||||
}
|
||||
}
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -1
|
||||
code:'FluMediaPlayer{
|
||||
id:player
|
||||
source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
|
||||
}
|
||||
'
|
||||
}
|
||||
FluArea{
|
||||
Layout.fillWidth: true
|
||||
height: 68
|
||||
Layout.topMargin: 20
|
||||
paddings: 10
|
||||
FluButton{
|
||||
text:"跳转到视频播放器窗口"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
onClicked:{
|
||||
FluApp.navigate("/media",{source:"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
FluRemoteLoader{
|
||||
property int pageMode: FluNavigationView.Standard
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url: ''
|
||||
source: "https://zhu-zichu.gitee.io/T_RemoteLoader.qml"
|
||||
}
|
||||
|
@ -14,12 +14,14 @@ FluScrollablePage{
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
width:100
|
||||
width:100,
|
||||
|
||||
},
|
||||
{
|
||||
title: '年龄',
|
||||
dataIndex: 'age',
|
||||
width:100
|
||||
dataIndex: 'item_age',
|
||||
width:100,
|
||||
minimumWidth:100
|
||||
},
|
||||
{
|
||||
title: '住址',
|
||||
@ -41,6 +43,62 @@ FluScrollablePage{
|
||||
loadData(1,10)
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_age
|
||||
Item{
|
||||
id:item_age
|
||||
property var ageArr: [100,300,500,1000]
|
||||
height: 60
|
||||
FluComboBox{
|
||||
width: 80
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 10
|
||||
}
|
||||
model: ListModel {
|
||||
ListElement { text: 100 }
|
||||
ListElement { text: 300 }
|
||||
ListElement { text: 500 }
|
||||
ListElement { text: 1000 }
|
||||
}
|
||||
Component.onCompleted: {
|
||||
currentIndex=ageArr.findIndex((element) => element === dataModel.age)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_action
|
||||
Item{
|
||||
height: 60
|
||||
Row{
|
||||
anchors.centerIn: parent
|
||||
spacing: 10
|
||||
FluFilledButton{
|
||||
text:"编辑"
|
||||
horizontalPadding: 6
|
||||
onClicked:{
|
||||
showError(JSON.stringify(dataObject))
|
||||
}
|
||||
}
|
||||
FluFilledButton{
|
||||
text:"删除"
|
||||
horizontalPadding: 6
|
||||
onClicked:{
|
||||
table_view.remove(dataModel.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluText{
|
||||
Layout.topMargin: 20
|
||||
text:"此TableView适用于小数据量,带分页的表格,大数据量请使用TableView2。"
|
||||
}
|
||||
|
||||
FluTableView{
|
||||
id:table_view
|
||||
Layout.fillWidth: true
|
||||
@ -54,30 +112,6 @@ FluScrollablePage{
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_action
|
||||
Item{
|
||||
Row{
|
||||
anchors.centerIn: parent
|
||||
spacing: 10
|
||||
FluFilledButton{
|
||||
text:"编辑"
|
||||
horizontalPadding: 6
|
||||
onClicked:{
|
||||
showSuccess(JSON.stringify(dataObject))
|
||||
}
|
||||
}
|
||||
FluFilledButton{
|
||||
text:"删除"
|
||||
horizontalPadding: 6
|
||||
onClicked:{
|
||||
showError(JSON.stringify(dataObject))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 10
|
||||
@ -130,13 +164,34 @@ FluScrollablePage{
|
||||
}
|
||||
|
||||
function loadData(page,count){
|
||||
var numbers = [100, 300, 500, 1000];
|
||||
function getRandomAge() {
|
||||
var randomIndex = Math.floor(Math.random() * numbers.length);
|
||||
return numbers[randomIndex];
|
||||
}
|
||||
var names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"];
|
||||
function getRandomName(){
|
||||
var randomIndex = Math.floor(Math.random() * names.length);
|
||||
return names[randomIndex];
|
||||
}
|
||||
var nicknames = ["复海大圣","混天大圣","移山大圣","通风大圣","驱神大圣","齐天大圣","平天大圣"]
|
||||
function getRandomNickname(){
|
||||
var randomIndex = Math.floor(Math.random() * nicknames.length);
|
||||
return nicknames[randomIndex];
|
||||
}
|
||||
var addresses = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
|
||||
function getRandomAddresses(){
|
||||
var randomIndex = Math.floor(Math.random() * addresses.length);
|
||||
return addresses[randomIndex];
|
||||
}
|
||||
const dataSource = []
|
||||
for(var i=0;i<count;i++){
|
||||
dataSource.push({
|
||||
name: "孙悟空%1".arg(((page-1)*count+i)),
|
||||
age: 500,
|
||||
address: "钟灵毓秀的花果山,如神仙仙境的水帘洞",
|
||||
nickname: "齐天大圣",
|
||||
name: getRandomName(),
|
||||
item_age: com_age,
|
||||
age:getRandomAge(),
|
||||
address: getRandomAddresses(),
|
||||
nickname: getRandomNickname(),
|
||||
action:com_action
|
||||
})
|
||||
}
|
||||
|
104
example/qml/page/T_TableView2.qml
Normal file
104
example/qml/page/T_TableView2.qml
Normal file
@ -0,0 +1,104 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Window
|
||||
import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
FluContentPage{
|
||||
|
||||
title:"TableView2"
|
||||
|
||||
Component.onCompleted: {
|
||||
loadData(1,2000)
|
||||
}
|
||||
|
||||
function loadData(page,count){
|
||||
var numbers = [100, 300, 500, 1000];
|
||||
function getRandomAge() {
|
||||
var randomIndex = Math.floor(Math.random() * numbers.length);
|
||||
return numbers[randomIndex];
|
||||
}
|
||||
var names = ["孙悟空", "猪八戒", "沙和尚", "唐僧","白骨夫人","金角大王","熊山君","黄风怪","银角大王"];
|
||||
function getRandomName(){
|
||||
var randomIndex = Math.floor(Math.random() * names.length);
|
||||
return names[randomIndex];
|
||||
}
|
||||
var nicknames = ["复海大圣","混天大圣","移山大圣","通风大圣","驱神大圣","齐天大圣","平天大圣"]
|
||||
function getRandomNickname(){
|
||||
var randomIndex = Math.floor(Math.random() * nicknames.length);
|
||||
return nicknames[randomIndex];
|
||||
}
|
||||
var addresses = ["傲来国界花果山水帘洞","傲来国界坎源山脏水洞","大唐国界黑风山黑风洞","大唐国界黄风岭黄风洞","大唐国界骷髅山白骨洞","宝象国界碗子山波月洞","宝象国界平顶山莲花洞","宝象国界压龙山压龙洞","乌鸡国界号山枯松涧火云洞","乌鸡国界衡阳峪黑水河河神府"]
|
||||
function getRandomAddresses(){
|
||||
var randomIndex = Math.floor(Math.random() * addresses.length);
|
||||
return addresses[randomIndex];
|
||||
}
|
||||
const dataSource = []
|
||||
for(var i=0;i<count;i++){
|
||||
dataSource.push({
|
||||
name: getRandomName(),
|
||||
age:getRandomAge(),
|
||||
address: getRandomAddresses(),
|
||||
nickname: getRandomNickname()
|
||||
})
|
||||
}
|
||||
table_view.dataSource = dataSource
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_combobox
|
||||
|
||||
FluComboBox {
|
||||
anchors.fill: parent
|
||||
currentIndex: display
|
||||
editable: true
|
||||
model: ListModel {
|
||||
ListElement { text: 100 }
|
||||
ListElement { text: 300 }
|
||||
ListElement { text: 500 }
|
||||
ListElement { text: 1000 }
|
||||
}
|
||||
Component.onCompleted: {
|
||||
currentIndex=[100,300,500,1000].findIndex((element) => element === Number(display))
|
||||
selectAll()
|
||||
}
|
||||
TableView.onCommit: {
|
||||
display = editText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluTableView2{
|
||||
id:table_view
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: 20
|
||||
columnSource:[
|
||||
{
|
||||
title: '姓名',
|
||||
dataIndex: 'name',
|
||||
width:100,
|
||||
|
||||
},
|
||||
{
|
||||
title: '年龄',
|
||||
dataIndex: 'age',
|
||||
editDelegate:com_combobox,
|
||||
width:100,
|
||||
minimumWidth:100
|
||||
},
|
||||
{
|
||||
title: '住址',
|
||||
dataIndex: 'address',
|
||||
width:200
|
||||
},
|
||||
{
|
||||
title: '别名',
|
||||
dataIndex: 'nickname',
|
||||
width:100
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
CustomWindow {
|
||||
|
||||
title:"视频播放器"
|
||||
width: 640
|
||||
height: 480
|
||||
minimumWidth: 640
|
||||
minimumHeight: 480
|
||||
|
||||
onInitArgument:
|
||||
(argument)=>{
|
||||
player.source = argument.source
|
||||
}
|
||||
|
||||
FluMediaPlayer{
|
||||
id:player
|
||||
anchors{
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -13,9 +13,9 @@ endif()
|
||||
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||
|
||||
#设置版本号
|
||||
add_definitions(-DVERSION=1,3,3,0)
|
||||
add_definitions(-DVERSION=1,3,4,0)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml ShaderTools)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
||||
|
||||
#遍历所有Cpp文件
|
||||
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||
|
@ -4,8 +4,9 @@ import FluentUI
|
||||
|
||||
Rectangle{
|
||||
property bool isDot: false
|
||||
property bool showZero: true
|
||||
property bool showZero: false
|
||||
property int count: 0
|
||||
property bool topRight: false
|
||||
id:control
|
||||
color:Qt.rgba(255/255,77/255,79/255,1)
|
||||
width: {
|
||||
@ -14,7 +15,7 @@ Rectangle{
|
||||
if(count<10){
|
||||
return 20
|
||||
}else if(count<100){
|
||||
return 30
|
||||
return 30
|
||||
}
|
||||
return 40
|
||||
}
|
||||
@ -30,35 +31,41 @@ Rectangle{
|
||||
}
|
||||
border.width: 1
|
||||
border.color: Qt.rgba(1,1,1,1)
|
||||
visible: {
|
||||
if(showZero)
|
||||
return true
|
||||
return count!==0
|
||||
}
|
||||
anchors{
|
||||
right: {
|
||||
if(parent)
|
||||
if(parent && topRight)
|
||||
return parent.right
|
||||
return undefined
|
||||
}
|
||||
top: {
|
||||
if(parent)
|
||||
if(parent && topRight)
|
||||
return parent.top
|
||||
return undefined
|
||||
}
|
||||
rightMargin: {
|
||||
if(isDot){
|
||||
return -2.5
|
||||
if(parent && topRight){
|
||||
if(isDot){
|
||||
return -2.5
|
||||
}
|
||||
return -(control.width/2)
|
||||
}
|
||||
return -(control.width/2)
|
||||
return 0
|
||||
}
|
||||
topMargin: {
|
||||
if(isDot){
|
||||
return -2.5
|
||||
if(parent && topRight){
|
||||
if(isDot){
|
||||
return -2.5
|
||||
}
|
||||
return -10
|
||||
}
|
||||
return -10
|
||||
return 0
|
||||
}
|
||||
}
|
||||
visible: {
|
||||
if(showZero)
|
||||
return true
|
||||
return count!==0
|
||||
}
|
||||
Text{
|
||||
anchors.centerIn: parent
|
||||
color: Qt.rgba(1,1,1,1)
|
||||
|
@ -24,7 +24,7 @@ ComboBox {
|
||||
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
|
||||
palette.text: control.palette.text
|
||||
palette.highlightedText: control.palette.highlightedText
|
||||
font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
|
||||
font.bold: control.currentIndex === index
|
||||
highlighted: control.highlightedIndex === index
|
||||
hoverEnabled: control.hoverEnabled
|
||||
}
|
||||
@ -37,7 +37,6 @@ ComboBox {
|
||||
iconSize: 15
|
||||
opacity: enabled ? 1 : 0.3
|
||||
}
|
||||
|
||||
contentItem: T.TextField {
|
||||
property bool disabled: !control.editable
|
||||
leftPadding: !control.mirrored ? 12 : control.editable && activeFocus ? 3 : 1
|
||||
@ -59,6 +58,7 @@ ComboBox {
|
||||
leftInset:1
|
||||
topInset:1
|
||||
bottomInset:1
|
||||
focus: true
|
||||
rightInset:1
|
||||
background: FluTextBoxBackground{
|
||||
border.width: 0
|
||||
@ -74,7 +74,7 @@ ComboBox {
|
||||
visible: !control.flat || control.down
|
||||
radius: 4
|
||||
FluFocusRectangle{
|
||||
visible: control.activeFocus
|
||||
visible: control.visualFocus
|
||||
radius:4
|
||||
anchors.margins: -2
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ Item {
|
||||
property int topPadding: 0
|
||||
property int rightPadding: 10
|
||||
property int bottomPadding: 10
|
||||
property int pageMode: FluNavigationView.Standard
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url: ''
|
||||
id:control
|
||||
FluText{
|
||||
id:text_title
|
||||
visible: text !== ""
|
||||
height: visible ? implicitHeight : 0
|
||||
height: visible ? contentHeight : 0
|
||||
font: FluTextStyle.Title
|
||||
anchors{
|
||||
top: parent.top
|
||||
|
@ -17,6 +17,9 @@ TextEdit {
|
||||
bottomPadding: 0
|
||||
selectionColor: FluTheme.primaryColor.lightest
|
||||
font:FluTextStyle.Body
|
||||
onSelectedTextChanged: {
|
||||
control.forceActiveFocus()
|
||||
}
|
||||
TapHandler {
|
||||
acceptedButtons: Qt.RightButton
|
||||
onTapped: control.echoMode !== TextInput.Password && menu.popup()
|
||||
|
@ -57,7 +57,7 @@ Item {
|
||||
iconSize: 15
|
||||
Behavior on rotation {
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
src/imports/FluentUI/Controls/FluHorizontalHeaderView.qml
Normal file
27
src/imports/FluentUI/Controls/FluHorizontalHeaderView.qml
Normal file
@ -0,0 +1,27 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates as T
|
||||
import FluentUI
|
||||
|
||||
T.HorizontalHeaderView {
|
||||
id: control
|
||||
implicitWidth: syncView ? syncView.width : 0
|
||||
implicitHeight: Math.max(1, contentHeight)
|
||||
delegate: Rectangle {
|
||||
readonly property real cellPadding: 8
|
||||
implicitWidth: text.implicitWidth + (cellPadding * 2)
|
||||
implicitHeight: Math.max(control.height, text.implicitHeight + (cellPadding * 2))
|
||||
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
|
||||
FluText {
|
||||
id: text
|
||||
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole]
|
||||
: model[control.textRole])
|
||||
: modelData
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
font.bold: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
@ -1,202 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
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
|
||||
onClicked: {
|
||||
showControl = !showControl
|
||||
}
|
||||
}
|
||||
MediaPlayer {
|
||||
id: mediaplayer
|
||||
property bool autoSeek:true
|
||||
source: control.source
|
||||
videoOutput: video_output
|
||||
audioOutput: AudioOutput{
|
||||
id:audio_output
|
||||
}
|
||||
onErrorStringChanged:
|
||||
(error)=> {
|
||||
console.debug(errorString)
|
||||
}
|
||||
onPositionChanged: {
|
||||
if(autoSeek){
|
||||
slider.seek(mediaplayer.position*slider.maxValue/mediaplayer.duration)
|
||||
}
|
||||
}
|
||||
onMediaStatusChanged:
|
||||
(status)=> {
|
||||
if(status===2){
|
||||
slider.maxValue = mediaplayer.duration
|
||||
showControl = true
|
||||
mediaplayer.play()
|
||||
}
|
||||
}
|
||||
}
|
||||
onSourceChanged: {
|
||||
slider.seek(0)
|
||||
}
|
||||
VideoOutput {
|
||||
id:video_output
|
||||
anchors.fill: parent
|
||||
}
|
||||
Item{
|
||||
height: 100
|
||||
y:showControl ? control.height - 110 : control.height
|
||||
anchors{
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
width: 460
|
||||
opacity: showControl
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
}
|
||||
Behavior on opacity{
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
Behavior on y{
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
}
|
||||
}
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color:FluTheme.dark ? Qt.rgba(45/255,45/255,45/255,0.97) : Qt.rgba(237/255,237/255,237/255,0.97)
|
||||
radius: 5
|
||||
}
|
||||
|
||||
FluSlider{
|
||||
id:slider
|
||||
size:parent.width-20
|
||||
y:20
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
tipEnabled:false
|
||||
onPressed: {
|
||||
mediaplayer.autoSeek = false
|
||||
mediaplayer.pause()
|
||||
}
|
||||
value:mediaplayer.position
|
||||
onReleased: {
|
||||
mediaplayer.autoSeek = true
|
||||
mediaplayer.play()
|
||||
}
|
||||
onValueChanged: {
|
||||
if(mediaplayer.autoSeek == false){
|
||||
mediaplayer.position = value*mediaplayer.duration/slider.maxValue
|
||||
}
|
||||
}
|
||||
onLineClickFunc:function(val){
|
||||
mediaplayer.position = val*mediaplayer.duration/slider.maxValue
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
id:start_time
|
||||
anchors{
|
||||
top: slider.bottom
|
||||
topMargin: 10
|
||||
left: slider.left
|
||||
}
|
||||
text: formatDuration(slider.value*mediaplayer.duration/slider.maxValue)
|
||||
}
|
||||
FluText{
|
||||
id:end_time
|
||||
anchors{
|
||||
top: slider.bottom
|
||||
right: slider.right
|
||||
topMargin: 10
|
||||
}
|
||||
text: formatDuration(mediaplayer.duration)
|
||||
}
|
||||
Row{
|
||||
spacing: 10
|
||||
anchors{
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 10
|
||||
}
|
||||
FluIconButton{
|
||||
iconSize: 17
|
||||
iconSource: FluentIcons.SkipBack10
|
||||
onClicked: {
|
||||
mediaplayer.position = Math.max(mediaplayer.position-10*1000,0)
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
iconSize: 15
|
||||
iconSource: mediaplayer.playbackState === MediaPlayer.PlayingState ? FluentIcons.Pause : FluentIcons.Play
|
||||
onClicked: {
|
||||
if(mediaplayer.playbackState === MediaPlayer.PlayingState){
|
||||
mediaplayer.pause()
|
||||
}else{
|
||||
mediaplayer.play()
|
||||
}
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
iconSize: 17
|
||||
iconSource: FluentIcons.SkipForward30
|
||||
onClicked: {
|
||||
mediaplayer.position = Math.min(mediaplayer.position+30*1000,mediaplayer.duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
id:btn_volume
|
||||
iconSize: 17
|
||||
iconSource: audio_output.muted ? FluentIcons.Mute : FluentIcons.Volume
|
||||
anchors{
|
||||
left: parent.left
|
||||
leftMargin: 5
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 10
|
||||
}
|
||||
onClicked: {
|
||||
audio_output.muted = !audio_output.muted
|
||||
}
|
||||
}
|
||||
FluSlider{
|
||||
id:slider_volume
|
||||
size: 80
|
||||
dotSize: 20
|
||||
value:30
|
||||
anchors{
|
||||
left:btn_volume.right
|
||||
verticalCenter: btn_volume.verticalCenter
|
||||
leftMargin: 10
|
||||
}
|
||||
onValueChanged:{
|
||||
audio_output.volume = value/100
|
||||
}
|
||||
}
|
||||
}
|
||||
function formatDuration(duration) {
|
||||
const seconds = Math.floor(duration / 1000);
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
const minutes = Math.floor((seconds % 3600) / 60);
|
||||
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()
|
||||
}
|
||||
}
|
@ -14,7 +14,8 @@ Item {
|
||||
}
|
||||
enum PageModeFlag{
|
||||
Standard = 0,
|
||||
SingleTask = 1
|
||||
SingleTask = 1,
|
||||
SingleTop = 2
|
||||
}
|
||||
property url logo
|
||||
property string title: ""
|
||||
@ -177,6 +178,33 @@ Item {
|
||||
}
|
||||
model.isExpand = !model.isExpand
|
||||
}
|
||||
Rectangle{
|
||||
color:Qt.rgba(255/255,77/255,79/255,1)
|
||||
width: 10
|
||||
height: 10
|
||||
radius: 5
|
||||
border.width: 1
|
||||
border.color: Qt.rgba(1,1,1,1)
|
||||
anchors{
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
rightMargin: 3
|
||||
verticalCenterOffset: -8
|
||||
}
|
||||
visible: {
|
||||
if(!model.isExpand){
|
||||
|
||||
for(var i=0;i<model.children.length;i++){
|
||||
var item = model.children[i]
|
||||
if(item.infoBadge && item.count !==0){
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
radius: 4
|
||||
anchors.fill: parent
|
||||
@ -198,7 +226,9 @@ Item {
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
FluIcon{
|
||||
id:item_icon_expand
|
||||
rotation: model.isExpand?0:180
|
||||
iconSource:FluentIcons.ChevronUp
|
||||
iconSize: 15
|
||||
@ -278,9 +308,11 @@ Item {
|
||||
}
|
||||
return true
|
||||
}
|
||||
elide: Text.ElideRight
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left:item_icon.right
|
||||
right: item_icon_expand.left
|
||||
}
|
||||
color:{
|
||||
if(item_control.pressed){
|
||||
@ -428,6 +460,7 @@ Item {
|
||||
}
|
||||
return true
|
||||
}
|
||||
elide: Text.ElideRight
|
||||
color:{
|
||||
if(item_control.pressed){
|
||||
return FluTheme.dark ? FluColors.Grey80 : FluColors.Grey120
|
||||
@ -437,6 +470,31 @@ Item {
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left:item_icon.right
|
||||
right: item_dot_loader.left
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id:item_dot_loader
|
||||
property bool isDot: (item_dot_loader.item&&item_dot_loader.item.isDot)
|
||||
anchors{
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
rightMargin: isDot ? 3 : 10
|
||||
verticalCenterOffset: isDot ? -8 : 0
|
||||
}
|
||||
sourceComponent: {
|
||||
if(model.infoBadge){
|
||||
return model.infoBadge
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
Connections{
|
||||
target: d
|
||||
function onIsCompactAndNotPanelChanged(){
|
||||
if(item_dot_loader.item){
|
||||
item_dot_loader.item.isDot = d.isCompactAndNotPanel
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -808,6 +866,14 @@ Item {
|
||||
duration: 83
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target: d
|
||||
function onIsCompactChanged(){
|
||||
if(!d.isCompact){
|
||||
control_popup.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
padding: 0
|
||||
focus: true
|
||||
contentItem: Item{
|
||||
@ -820,7 +886,7 @@ Item {
|
||||
ScrollBar.vertical: FluScrollBar {}
|
||||
delegate:Button{
|
||||
id:item_button
|
||||
width: 160
|
||||
width: 180
|
||||
padding:10
|
||||
focusPolicy:Qt.TabFocus
|
||||
background: Rectangle{
|
||||
@ -834,9 +900,27 @@ Item {
|
||||
visible: item_button.activeFocus
|
||||
radius:4
|
||||
}
|
||||
|
||||
Loader{
|
||||
id:item_dot_loader
|
||||
anchors{
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
rightMargin: 10
|
||||
}
|
||||
sourceComponent: {
|
||||
if(model.infoBadge){
|
||||
return model.infoBadge
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
contentItem: FluText{
|
||||
text:modelData.title
|
||||
elide: Text.ElideRight
|
||||
rightPadding: item_dot_loader.width
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
@ -858,7 +942,7 @@ Item {
|
||||
}
|
||||
}
|
||||
background: FluRectangle{
|
||||
implicitWidth: 160
|
||||
implicitWidth: 180
|
||||
implicitHeight: 38*Math.min(Math.max(list_view.count,1),8)
|
||||
radius: [4,4,4,4]
|
||||
FluShadow{
|
||||
@ -893,9 +977,6 @@ Item {
|
||||
return nav_list.model
|
||||
}
|
||||
function push(url,argument={}){
|
||||
if(nav_swipe.currentItem && nav_swipe.currentItem.url === url){
|
||||
return
|
||||
}
|
||||
let page = nav_swipe.find(function(item) {
|
||||
return item.url === url;
|
||||
})
|
||||
@ -909,6 +990,11 @@ Item {
|
||||
d.stackItems.pop()
|
||||
}
|
||||
return
|
||||
case FluNavigationView.SingleTop:
|
||||
if (nav_swipe.currentItem.url === url){
|
||||
return
|
||||
}
|
||||
break
|
||||
case FluNavigationView.Standard:
|
||||
default:
|
||||
}
|
||||
@ -919,6 +1005,12 @@ Item {
|
||||
function getCurrentIndex(){
|
||||
return nav_list.currentIndex
|
||||
}
|
||||
function getCurrentUrl(){
|
||||
if(nav_swipe.currentItem){
|
||||
return nav_swipe.currentItem.url
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
function startPageByItem(data){
|
||||
var items = getItems()
|
||||
for(var i=0;i<items.length;i++){
|
||||
|
@ -9,12 +9,14 @@ QtObject {
|
||||
property int order : 0
|
||||
property int icon
|
||||
property Component cusIcon
|
||||
property Component infoBadge
|
||||
property bool recentlyAdded: false
|
||||
property bool recentlyUpdated: false
|
||||
property string desc
|
||||
property var image
|
||||
property var parent
|
||||
property int idx
|
||||
property int count: 0
|
||||
signal tap
|
||||
property var tapFunc
|
||||
}
|
||||
|
@ -2,25 +2,30 @@ import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
id:control
|
||||
FluStatusView {
|
||||
property url source: ""
|
||||
|
||||
color:"transparent"
|
||||
id:control
|
||||
onErrorClicked: {
|
||||
reload()
|
||||
}
|
||||
Loader{
|
||||
id:loader
|
||||
anchors.fill: parent
|
||||
source: control.source
|
||||
asynchronous: true
|
||||
onStatusChanged: {
|
||||
if(status === Loader.Error){
|
||||
control.statusMode = FluStatusView.Error
|
||||
}else if(status === Loader.Loading){
|
||||
control.statusMode = FluStatusView.Loading
|
||||
}else{
|
||||
control.statusMode = FluStatusView.Success
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluProgressRing{
|
||||
anchors.centerIn: parent
|
||||
visible: loader.status === Loader.Loading
|
||||
}
|
||||
|
||||
function reload(){
|
||||
var timestamp = Date.now();
|
||||
loader.source = control.source+"?"+timestamp
|
||||
}
|
||||
|
||||
}
|
||||
|
49
src/imports/FluentUI/Controls/FluScrollIndicator.qml
Normal file
49
src/imports/FluentUI/Controls/FluScrollIndicator.qml
Normal file
@ -0,0 +1,49 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls.impl
|
||||
import QtQuick.Templates as T
|
||||
|
||||
T.ScrollIndicator {
|
||||
id: control
|
||||
|
||||
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
|
||||
implicitContentWidth + leftPadding + rightPadding)
|
||||
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding)
|
||||
|
||||
padding: 2
|
||||
|
||||
contentItem: Rectangle {
|
||||
implicitWidth: 2
|
||||
implicitHeight: 2
|
||||
|
||||
color: control.palette.mid
|
||||
visible: control.size < 1.0
|
||||
opacity: 0.0
|
||||
|
||||
states: State {
|
||||
name: "active"
|
||||
when: control.active
|
||||
PropertyChanges {
|
||||
target: control
|
||||
contentItem.opacity: 0.75
|
||||
}
|
||||
}
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "active"
|
||||
SequentialAnimation {
|
||||
PauseAnimation {
|
||||
duration: 450
|
||||
}
|
||||
NumberAnimation {
|
||||
target: control.contentItem
|
||||
duration: 200
|
||||
property: "opacity"
|
||||
to: 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -12,14 +12,14 @@ Item {
|
||||
property int topPadding: 0
|
||||
property int rightPadding: 10
|
||||
property int bottomPadding: 10
|
||||
property int pageMode: FluNavigationView.Standard
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url: ''
|
||||
id:control
|
||||
FluText{
|
||||
id:text_title
|
||||
font: FluTextStyle.Title
|
||||
visible: text !== ""
|
||||
height: visible ? implicitHeight : 0
|
||||
height: visible ? contentHeight : 0
|
||||
padding: 0
|
||||
anchors{
|
||||
top: parent.top
|
||||
|
@ -81,7 +81,7 @@ Item{
|
||||
}
|
||||
Behavior on scale {
|
||||
NumberAnimation{
|
||||
duration: 150
|
||||
duration: 167
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,11 @@ Item{
|
||||
}
|
||||
default property alias content: container.data
|
||||
property int statusMode: FluStatusView.Loading
|
||||
property string loadingText:"正在加载..."
|
||||
property string emptyText: "空空如也"
|
||||
property string errorText: "页面出错了.."
|
||||
property string errorButtonText: "重新加载"
|
||||
property color 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)
|
||||
signal errorClicked
|
||||
Item{
|
||||
id:container
|
||||
@ -28,6 +33,7 @@ Item{
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 83 }
|
||||
}
|
||||
color:control.color
|
||||
ColumnLayout{
|
||||
anchors.centerIn: parent
|
||||
visible: statusMode === FluStatusView.Loading
|
||||
@ -36,7 +42,7 @@ Item{
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
FluText{
|
||||
text:"正在加载..."
|
||||
text:control.loadingText
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
}
|
||||
@ -46,6 +52,7 @@ Item{
|
||||
border.width: 0
|
||||
anchors.fill: container
|
||||
visible: opacity
|
||||
color:control.color
|
||||
opacity: statusMode === FluStatusView.Empty
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 83 }
|
||||
@ -54,7 +61,7 @@ Item{
|
||||
anchors.centerIn: parent
|
||||
visible: statusMode === FluStatusView.Empty
|
||||
FluText{
|
||||
text:"空空如也"
|
||||
text:control.emptyText
|
||||
font: FluTextStyle.BodyStrong
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
@ -65,6 +72,7 @@ Item{
|
||||
border.width: 0
|
||||
anchors.fill: container
|
||||
visible: opacity
|
||||
color:control.color
|
||||
opacity: statusMode === FluStatusView.Error
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 83 }
|
||||
@ -72,14 +80,14 @@ Item{
|
||||
ColumnLayout{
|
||||
anchors.centerIn: parent
|
||||
FluText{
|
||||
text:"页面出错了..."
|
||||
text:control.errorText
|
||||
font: FluTextStyle.BodyStrong
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
FluFilledButton{
|
||||
id:btn_error
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text:"重新加载"
|
||||
text:control.errorButtonText
|
||||
onClicked:{
|
||||
control.errorClicked()
|
||||
}
|
||||
|
5
src/imports/FluentUI/Controls/FluTableModelColumn.qml
Normal file
5
src/imports/FluentUI/Controls/FluTableModelColumn.qml
Normal file
@ -0,0 +1,5 @@
|
||||
import Qt.labs.qmlmodels
|
||||
|
||||
TableModelColumn{
|
||||
|
||||
}
|
@ -17,7 +17,7 @@ Item {
|
||||
implicitHeight: layout_table.height
|
||||
QtObject{
|
||||
id:d
|
||||
property int columnsWidth: parent.width
|
||||
property int columnsWidth: layout_table.headerItem.columnsWidth()
|
||||
}
|
||||
MouseArea{
|
||||
anchors.fill: parent
|
||||
@ -32,17 +32,89 @@ Item {
|
||||
onColumnsChanged: {
|
||||
model_columns.clear()
|
||||
model_columns.append(columns)
|
||||
var w = 0
|
||||
for(var i=0;i<model_columns.count;i++){
|
||||
var item = model_columns.get(i)
|
||||
w=w+item.width
|
||||
}
|
||||
d.columnsWidth = w
|
||||
}
|
||||
onDataSourceChanged: {
|
||||
model_data_source.clear()
|
||||
model_data_source.append(dataSource)
|
||||
}
|
||||
|
||||
Component{
|
||||
id:header_columns
|
||||
FluRectangle{
|
||||
id:layout_columns
|
||||
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]
|
||||
function columnsWidth(){
|
||||
var w = 0
|
||||
for(var i=0;i<repeater_columns.count;i++){
|
||||
var item = repeater_columns.itemAt(i)
|
||||
w=w+item.width
|
||||
}
|
||||
return w
|
||||
}
|
||||
function widthByColumnIndex(index){
|
||||
return repeater_columns.itemAt(index).width
|
||||
}
|
||||
Row{
|
||||
id:list_columns
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
Repeater{
|
||||
id:repeater_columns
|
||||
model: model_columns
|
||||
delegate: Item{
|
||||
id:item_column
|
||||
property point clickPos: "0,0"
|
||||
height: list_columns.height
|
||||
width: model.width
|
||||
FluText{
|
||||
id:item_column_text
|
||||
text:model.title
|
||||
wrapMode: Text.WordWrap
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 14
|
||||
}
|
||||
font: FluTextStyle.BodyStrong
|
||||
}
|
||||
FluDivider{
|
||||
id:item_divider
|
||||
width: 1
|
||||
height: 40
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: index !== model_columns.count-1
|
||||
}
|
||||
MouseArea{
|
||||
height: 40
|
||||
width: 6
|
||||
anchors.centerIn: item_divider
|
||||
visible: item_divider.visible
|
||||
cursorShape: Qt.SplitHCursor
|
||||
onPressed:
|
||||
(mouse)=>{
|
||||
clickPos = Qt.point(mouse.x, mouse.y)
|
||||
}
|
||||
preventStealing: true
|
||||
onPositionChanged:
|
||||
(mouse)=>{
|
||||
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y)
|
||||
var minimumWidth = item_column_text.implicitWidth+28
|
||||
if(model.minimumWidth){
|
||||
minimumWidth = model.minimumWidth
|
||||
}
|
||||
item_column.width = Math.max(item_column.width+delta.x,minimumWidth)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flickable{
|
||||
id:layout_flickable
|
||||
height: layout_table.height
|
||||
@ -66,44 +138,12 @@ Item {
|
||||
width: Math.max(layout_flickable.width,d.columnsWidth)
|
||||
clip:true
|
||||
interactive: false
|
||||
header: FluRectangle{
|
||||
id:layout_columns
|
||||
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_columns
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
Repeater{
|
||||
model: model_columns
|
||||
delegate: Item{
|
||||
height: list_columns.height
|
||||
width: model.width
|
||||
FluText{
|
||||
text:model.title
|
||||
wrapMode: Text.WordWrap
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 14
|
||||
}
|
||||
font: FluTextStyle.BodyStrong
|
||||
}
|
||||
FluDivider{
|
||||
width: 1
|
||||
height: 40
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: index !== model_columns.count-1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
removeDisplaced: Transition {
|
||||
NumberAnimation { properties: "x,y"; duration: 167 }
|
||||
}
|
||||
header: header_columns
|
||||
footer: Item{
|
||||
height: pageVisible ? 50 : 0
|
||||
height: pageVisible ? 54 : 0
|
||||
clip: true
|
||||
width: layout_table.width
|
||||
FluPagination{
|
||||
@ -135,7 +175,7 @@ Item {
|
||||
model:model_data_source
|
||||
delegate: Control{
|
||||
id:item_control
|
||||
height: table_row.maxHeight
|
||||
height: maxHeight()
|
||||
width: layout_table.width
|
||||
property var model_values : getObjectValues(index)
|
||||
property var itemObject: getObject(index)
|
||||
@ -149,60 +189,78 @@ Item {
|
||||
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
id:item_divider
|
||||
width: parent.width
|
||||
height: 1
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
Row{
|
||||
id: table_row
|
||||
spacing: 0
|
||||
anchors.fill: parent
|
||||
property int maxHeight: itemHeight
|
||||
Repeater{
|
||||
id:repeater_rows
|
||||
model: model_values
|
||||
delegate:Item{
|
||||
height: table_row.maxHeight
|
||||
width: modelData.width
|
||||
delegate:FluControl{
|
||||
id:item_row_control
|
||||
width: layout_table.headerItem.widthByColumnIndex(index)
|
||||
height: item_control.height
|
||||
focusPolicy:Qt.TabFocus
|
||||
background: Item{
|
||||
FluFocusRectangle{
|
||||
visible: item_row_control.activeFocus
|
||||
radius:8
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
id:item_column_loader
|
||||
property var model : modelData
|
||||
property var dataModel : listModel
|
||||
property var dataObject : itemObject
|
||||
anchors.fill: parent
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width
|
||||
sourceComponent: {
|
||||
if(model.itemData instanceof Component){
|
||||
return model.itemData
|
||||
}
|
||||
return com_text
|
||||
}
|
||||
onHeightChanged:
|
||||
{
|
||||
table_row.maxHeight = Math.max(table_row.maxHeight,height,itemHeight)
|
||||
parent.height = table_row.maxHeight
|
||||
table_row.parent.height = table_row.maxHeight
|
||||
}
|
||||
}
|
||||
function columnHeight(){
|
||||
return item_column_loader.item.height
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
FluDivider{
|
||||
width: parent.width
|
||||
height: 1
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
function maxHeight(){
|
||||
var h = 0
|
||||
for(var i=0;i<repeater_rows.count;i++){
|
||||
var item = repeater_rows.itemAt(i)
|
||||
h=Math.max(h,item.columnHeight())
|
||||
}
|
||||
return h
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_text
|
||||
Item{
|
||||
height: table_value.implicitHeight + 20
|
||||
FluCopyableText{
|
||||
id:table_value
|
||||
text:String(model.itemData)
|
||||
width: Math.min(parent.width - 14,implicitWidth)
|
||||
wrapMode: Text.WordWrap
|
||||
onImplicitHeightChanged: parent.parent.parent.height = Math.max(implicitHeight + 20,itemHeight)
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
leftMargin: 14
|
||||
}
|
||||
rightPadding: 14
|
||||
MouseArea{
|
||||
id:item_mouse
|
||||
hoverEnabled: true
|
||||
@ -232,4 +290,7 @@ Item {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
function remove(index){
|
||||
model_data_source.remove(index)
|
||||
}
|
||||
}
|
||||
|
169
src/imports/FluentUI/Controls/FluTableView2.qml
Normal file
169
src/imports/FluentUI/Controls/FluTableView2.qml
Normal file
@ -0,0 +1,169 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import Qt.labs.qmlmodels
|
||||
import FluentUI
|
||||
|
||||
|
||||
Rectangle {
|
||||
|
||||
id:control
|
||||
|
||||
property var columnSource
|
||||
property var dataSource
|
||||
color: FluTheme.dark ? Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||
onColumnSourceChanged: {
|
||||
if(columnSource.length!==0){
|
||||
var com_column = Qt.createComponent("FluTableModelColumn.qml")
|
||||
if (com_column.status === Component.Ready) {
|
||||
var columns= []
|
||||
columnSource.forEach(function(item){
|
||||
var column = com_column.createObject(table_model,{display:item.dataIndex});
|
||||
columns.push(column)
|
||||
})
|
||||
table_model.columns = columns
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TableModel {
|
||||
id:table_model
|
||||
}
|
||||
|
||||
onDataSourceChanged: {
|
||||
table_model.clear()
|
||||
dataSource.forEach(function(item){
|
||||
table_model.appendRow(item)
|
||||
})
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_edit
|
||||
FluTextBox {
|
||||
anchors.fill: parent
|
||||
text: display
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
Component.onCompleted: selectAll()
|
||||
TableView.onCommit: {
|
||||
display = text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView{
|
||||
id:scroll_table
|
||||
anchors.left: header_vertical.right
|
||||
anchors.top: header_horizontal.bottom
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
||||
TableView {
|
||||
id:table_view
|
||||
ListModel{
|
||||
id:model_columns
|
||||
}
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
ScrollBar.horizontal: FluScrollBar{}
|
||||
ScrollBar.vertical: FluScrollBar{}
|
||||
selectionModel: ItemSelectionModel {}
|
||||
columnWidthProvider: function(column) {
|
||||
let w = explicitColumnWidth(column)
|
||||
if (w >= 0){
|
||||
return Math.max(100, w)
|
||||
}
|
||||
return implicitColumnWidth(column)
|
||||
}
|
||||
rowHeightProvider: function(row) {
|
||||
let h = explicitRowHeight(row)
|
||||
if (h >= 0){
|
||||
return Math.max(40, h)
|
||||
}
|
||||
return implicitRowHeight(row)
|
||||
}
|
||||
model: table_model
|
||||
clip: true
|
||||
delegate: Rectangle {
|
||||
required property bool selected
|
||||
required property bool current
|
||||
color: selected ? FluTheme.primaryColor.lightest: (row%2!==0) ? control.color : (FluTheme.dark ? Qt.rgba(1,1,1,0.06) : Qt.rgba(0,0,0,0.06))
|
||||
implicitHeight: 40
|
||||
implicitWidth: columnSource[column].width
|
||||
FluText {
|
||||
text: display
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
elide: Text.ElideRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
TableView.editDelegate: {
|
||||
var obj =columnSource[column].editDelegate
|
||||
if(obj){
|
||||
return obj
|
||||
}
|
||||
return com_edit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component{
|
||||
id:com_handle
|
||||
FluControl {
|
||||
width: 24
|
||||
height: 24
|
||||
background: Rectangle{
|
||||
radius: 12
|
||||
color: FluTheme.dark ? Qt.rgba(69/255,69/255,69/255,1) :Qt.rgba(1,1,1,1)
|
||||
}
|
||||
visible: SelectionRectangle.control.active
|
||||
FluShadow{
|
||||
radius: 12
|
||||
}
|
||||
Rectangle{
|
||||
width: 24
|
||||
height: 24
|
||||
radius: 12
|
||||
scale: pressed?4/10:hovered?6/10:5/10
|
||||
color:FluTheme.dark ? FluTheme.primaryColor.lighter :FluTheme.primaryColor.dark
|
||||
anchors.centerIn: parent
|
||||
Behavior on scale {
|
||||
NumberAnimation{
|
||||
duration: 167
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SelectionRectangle {
|
||||
target: table_view
|
||||
bottomRightHandle:com_handle
|
||||
topLeftHandle: com_handle
|
||||
}
|
||||
|
||||
|
||||
FluHorizontalHeaderView {
|
||||
id: header_horizontal
|
||||
textRole: "title"
|
||||
model: columnSource
|
||||
anchors.left: scroll_table.left
|
||||
anchors.top: parent.top
|
||||
syncView: table_view
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
clip: true
|
||||
}
|
||||
|
||||
FluVerticalHeaderView {
|
||||
id: header_vertical
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
anchors.top: scroll_table.top
|
||||
anchors.left: parent.left
|
||||
syncView: table_view
|
||||
clip: true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
27
src/imports/FluentUI/Controls/FluVerticalHeaderView.qml
Normal file
27
src/imports/FluentUI/Controls/FluVerticalHeaderView.qml
Normal file
@ -0,0 +1,27 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates as T
|
||||
import FluentUI
|
||||
|
||||
T.VerticalHeaderView {
|
||||
id: control
|
||||
implicitWidth: Math.max(1, contentWidth)
|
||||
implicitHeight: syncView ? syncView.height : 0
|
||||
delegate: Rectangle {
|
||||
readonly property real cellPadding: 8
|
||||
implicitWidth: Math.max(control.width, text.implicitWidth + (cellPadding * 2))
|
||||
implicitHeight: text.implicitHeight + (cellPadding * 2)
|
||||
color:FluTheme.dark ? Qt.rgba(50/255,50/255,50/255,1) : Qt.rgba(247/255,247/255,247/255,1)
|
||||
border.color: FluTheme.dark ? "#252525" : "#e4e4e4"
|
||||
FluText {
|
||||
id: text
|
||||
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole]
|
||||
: model[control.textRole])
|
||||
: modelData
|
||||
width: parent.width
|
||||
font.bold: true
|
||||
height: parent.height
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
@ -1,144 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Window
|
||||
import FluentUI
|
||||
|
||||
MouseArea {
|
||||
|
||||
property int border: 4
|
||||
property var window: Window.window
|
||||
property bool fixedSize: {
|
||||
if(window == null)
|
||||
return true
|
||||
if(window.visibility === Window.Maximized || window.visibility === Window.FullScreen){
|
||||
return true
|
||||
}
|
||||
return (window.minimumWidth === window.maximumWidth && window.minimumHeight === window.maximumHeight)
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
preventStealing: true
|
||||
propagateComposedEvents: true
|
||||
z: -65535
|
||||
|
||||
onPressed :
|
||||
(mouse)=> {
|
||||
if (fixedSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
let e = 0;
|
||||
if (ptInRect(0,0,border,border, mouse.x, mouse.y)) {
|
||||
e = Qt.TopEdge | Qt.LeftEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(border,0,window.width-border*2,border, mouse.x, mouse.y)) {
|
||||
e = Qt.TopEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(window.width-border,0,border,border, mouse.x, mouse.y)) {
|
||||
e = Qt.TopEdge | Qt.RightEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(window.width-border,border,border,window.height-border*2, mouse.x, mouse.y)) {
|
||||
e = Qt.RightEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(window.width-border,window.height-border,border,border, mouse.x, mouse.y)) {
|
||||
e = Qt.BottomEdge | Qt.RightEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(border,window.height-border,window.width-border*2,border, mouse.x, mouse.y)) {
|
||||
e = Qt.BottomEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(0,window.height-border,border,border, mouse.x, mouse.y)) {
|
||||
e = Qt.BottomEdge | Qt.LeftEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(0,border,border , window.height-border*2, mouse.x, mouse.y)) {
|
||||
e = Qt.LeftEdge;
|
||||
window.startSystemResize(e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
onPositionChanged:
|
||||
(mouse)=> {
|
||||
if (fixedSize) {
|
||||
cursorShape = Qt.ArrowCursor;
|
||||
return;
|
||||
}
|
||||
if (ptInRect(0,0,border,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeFDiagCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(border,0,window.width-border*2,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeVerCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(window.width-border,0,border,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeBDiagCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(window.width-border,border,border,window.height-border*2, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeHorCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(window.width-border,window.height-border,border,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeFDiagCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(border,window.height-border,window.width-border*2,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeVerCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(0,window.height-border,border,border, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeBDiagCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
if (ptInRect(0,border,border, window.height-border*2, mouse.x, mouse.y)) {
|
||||
cursorShape = Qt.SizeHorCursor;
|
||||
return;
|
||||
}
|
||||
|
||||
cursorShape = Qt.ArrowCursor;
|
||||
}
|
||||
|
||||
onExited: {
|
||||
cursorShape = Qt.ArrowCursor;
|
||||
}
|
||||
|
||||
function ptInRect(rcx,rcy,rcwidth,rcheight, x, y)
|
||||
{
|
||||
if ((rcx <= x && x <= (rcx + rcwidth)) &&
|
||||
(rcy <= y && y <= (rcy + rcheight))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user