mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-27 13:49:08 +08:00
Merge branch 'main' of https://github.com/zhuzichu520/FluentUI
This commit is contained in:
commit
f830d5a9bf
@ -22,18 +22,37 @@ FluScrollablePage{
|
||||
|
||||
FluGroupBox {
|
||||
title: qsTr("RadioButton Group")
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 150
|
||||
Layout.topMargin: 20
|
||||
FluRadioButtons {
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
}
|
||||
spacing: 10
|
||||
disabled: radio_button_switch.checked
|
||||
FluRadioButton { text: qsTr("E-mail") }
|
||||
FluRadioButton { text: qsTr("Calendar") }
|
||||
FluRadioButton { text: qsTr("Contacts") }
|
||||
}
|
||||
|
||||
FluToggleSwitch{
|
||||
id: radio_button_switch
|
||||
anchors{
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: qsTr("Disabled")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 4
|
||||
code:'FluGroupBox {
|
||||
code:`
|
||||
FluGroupBox {
|
||||
title: qsTr("CheckBox Group")
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
@ -42,7 +61,20 @@ FluScrollablePage{
|
||||
FluCheckBox { text: qsTr("Calendar") }
|
||||
FluCheckBox { text: qsTr("Contacts") }
|
||||
}
|
||||
}'
|
||||
}
|
||||
|
||||
FluGroupBox {
|
||||
title: qsTr("RadioButton Group")
|
||||
FluRadioButtons {
|
||||
spacing: 10
|
||||
disabled: true // 禁用所有FluRadioButton子组件
|
||||
manuallyDisabled: true // 是否指定每个FluRadioButton上的disabled选项
|
||||
FluRadioButton { text: qsTr("E-mail") }
|
||||
FluRadioButton { text: qsTr("Calendar") }
|
||||
FluRadioButton { text: qsTr("Contacts") }
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,9 +9,13 @@ FluScrollablePage{
|
||||
|
||||
title: qsTr("InfoBar")
|
||||
|
||||
property var info1
|
||||
property var info2
|
||||
property var info3
|
||||
|
||||
FluFrame{
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 270
|
||||
Layout.preferredHeight: 350
|
||||
padding: 10
|
||||
ColumnLayout{
|
||||
spacing: 14
|
||||
@ -49,6 +53,51 @@ FluScrollablePage{
|
||||
showInfo(qsTr("This is an InfoBar in the Info Style"),0,qsTr("Manual shutdown is supported"))
|
||||
}
|
||||
}
|
||||
FluText{
|
||||
wrapMode: Text.WrapAnywhere
|
||||
width: parent.width
|
||||
text: qsTr("Manually close the info message box")
|
||||
}
|
||||
Row{
|
||||
spacing: 5
|
||||
FluButton{
|
||||
text: (info1 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info1")
|
||||
onClicked: {
|
||||
if(info1) {
|
||||
info1.close()
|
||||
return
|
||||
}
|
||||
info1 = showInfo(qsTr("This is an '%1'").arg("info1"), 0)
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text: (info2 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info2")
|
||||
onClicked: {
|
||||
if(info2) {
|
||||
info2.close()
|
||||
return
|
||||
}
|
||||
info2 = showInfo(qsTr("This is an '%1'").arg("info2"), 0)
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text: (info3 ? qsTr("close '%1'") : qsTr("show '%1")).arg("info3")
|
||||
onClicked: {
|
||||
if(info3) {
|
||||
info3.close()
|
||||
return
|
||||
}
|
||||
info3 = showInfo(qsTr("This is an '%1'").arg("info3"), 0)
|
||||
}
|
||||
}
|
||||
FluButton{
|
||||
text: qsTr("clear all info")
|
||||
onClicked: {
|
||||
clearAllInfo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluButton{
|
||||
text:"Loading"
|
||||
onClicked: {
|
||||
@ -60,12 +109,17 @@ FluScrollablePage{
|
||||
CodeExpander{
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: -6
|
||||
code:'showInfo(qsTr("This is an InfoBar in the Info Style"))
|
||||
code:`
|
||||
showInfo(qsTr("This is an InfoBar in the Info Style"))
|
||||
|
||||
showWarning(qsTr("This is an InfoBar in the Warning Style"))
|
||||
|
||||
showError(qsTr("This is an InfoBar in the Error Style"))
|
||||
|
||||
showSuccess(qsTr("This is an InfoBar in the Success Style"))'
|
||||
showSuccess(qsTr("This is an InfoBar in the Success Style"))
|
||||
|
||||
var info1 = showInfo(qsTr("This is an 'Info1'"), 0)
|
||||
info1.close()
|
||||
`
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,13 @@ FluObject {
|
||||
if(screenLayout){
|
||||
var last = screenLayout.getLastloader();
|
||||
if(last.type === type && last.text === text && moremsg === last.moremsg){
|
||||
last.restart();
|
||||
return;
|
||||
last.duration = duration
|
||||
if (duration > 0) last.restart();
|
||||
return last;
|
||||
}
|
||||
}
|
||||
initScreenLayout();
|
||||
contentComponent.createObject(screenLayout,{
|
||||
return contentComponent.createObject(screenLayout,{
|
||||
type:type,
|
||||
text:text,
|
||||
duration:duration,
|
||||
@ -33,7 +34,7 @@ FluObject {
|
||||
function createCustom(itemcomponent,duration){
|
||||
initScreenLayout();
|
||||
if(itemcomponent){
|
||||
contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
|
||||
return contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
|
||||
}
|
||||
}
|
||||
function initScreenLayout(){
|
||||
@ -85,7 +86,9 @@ FluObject {
|
||||
}
|
||||
Timer {
|
||||
id:delayTimer
|
||||
interval: duration; running: duration > 0; repeat: duration > 0
|
||||
interval: duration;
|
||||
running: duration > 0;
|
||||
repeat: duration > 0
|
||||
onTriggered: content.close();
|
||||
}
|
||||
FluLoader{
|
||||
@ -235,18 +238,26 @@ FluObject {
|
||||
}
|
||||
}
|
||||
function showSuccess(text,duration=1000,moremsg){
|
||||
mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
|
||||
return mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
|
||||
}
|
||||
function showInfo(text,duration=1000,moremsg){
|
||||
mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
|
||||
return mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
|
||||
}
|
||||
function showWarning(text,duration=1000,moremsg){
|
||||
mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
|
||||
return mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
|
||||
}
|
||||
function showError(text,duration=1000,moremsg){
|
||||
mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
|
||||
return mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
|
||||
}
|
||||
function showCustom(itemcomponent,duration=1000){
|
||||
mcontrol.createCustom(itemcomponent,duration);
|
||||
return mcontrol.createCustom(itemcomponent,duration);
|
||||
}
|
||||
function clearAllInfo(){
|
||||
if(mcontrol.screenLayout != null) {
|
||||
mcontrol.screenLayout.destroy()
|
||||
mcontrol.screenLayout = null
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ import FluentUI 1.0
|
||||
ColumnLayout {
|
||||
default property alias buttons: control.data
|
||||
property int currentIndex : -1
|
||||
property bool disabled: false
|
||||
property bool manuallyDisabled: false
|
||||
id:control
|
||||
onCurrentIndexChanged: {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
@ -16,6 +18,12 @@ ColumnLayout {
|
||||
button.checked = true
|
||||
}
|
||||
}
|
||||
onDisabledChanged: {
|
||||
refreshButtonStatus()
|
||||
}
|
||||
onManuallyDisabledChanged: {
|
||||
refreshButtonStatus()
|
||||
}
|
||||
Component.onCompleted: {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
buttons[i].clickListener = function(){
|
||||
@ -27,6 +35,12 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
currentIndex = 0
|
||||
refreshButtonStatus()
|
||||
}
|
||||
|
||||
function refreshButtonStatus() {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
if(!manuallyDisabled) buttons[i].enabled = !disabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,16 +289,19 @@ Window {
|
||||
loader_loading.sourceComponent = undefined
|
||||
}
|
||||
function showSuccess(text,duration,moremsg){
|
||||
info_bar.showSuccess(text,duration,moremsg)
|
||||
return info_bar.showSuccess(text,duration,moremsg)
|
||||
}
|
||||
function showInfo(text,duration,moremsg){
|
||||
info_bar.showInfo(text,duration,moremsg)
|
||||
return info_bar.showInfo(text,duration,moremsg)
|
||||
}
|
||||
function showWarning(text,duration,moremsg){
|
||||
info_bar.showWarning(text,duration,moremsg)
|
||||
return info_bar.showWarning(text,duration,moremsg)
|
||||
}
|
||||
function showError(text,duration,moremsg){
|
||||
info_bar.showError(text,duration,moremsg)
|
||||
return info_bar.showError(text,duration,moremsg)
|
||||
}
|
||||
function clearAllInfo(){
|
||||
return info_bar.clearAllInfo()
|
||||
}
|
||||
function moveWindowToDesktopCenter(){
|
||||
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
||||
|
@ -1,6 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import FluentUI 1.0
|
||||
|
||||
FluObject {
|
||||
property var root;
|
||||
@ -18,12 +18,13 @@ FluObject {
|
||||
if(screenLayout){
|
||||
var last = screenLayout.getLastloader();
|
||||
if(last.type === type && last.text === text && moremsg === last.moremsg){
|
||||
last.restart();
|
||||
return;
|
||||
last.duration = duration
|
||||
if (duration > 0) last.restart();
|
||||
return last;
|
||||
}
|
||||
}
|
||||
initScreenLayout();
|
||||
contentComponent.createObject(screenLayout,{
|
||||
return contentComponent.createObject(screenLayout,{
|
||||
type:type,
|
||||
text:text,
|
||||
duration:duration,
|
||||
@ -33,7 +34,7 @@ FluObject {
|
||||
function createCustom(itemcomponent,duration){
|
||||
initScreenLayout();
|
||||
if(itemcomponent){
|
||||
contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
|
||||
return contentComponent.createObject(screenLayout,{itemcomponent:itemcomponent,duration:duration});
|
||||
}
|
||||
}
|
||||
function initScreenLayout(){
|
||||
@ -85,7 +86,9 @@ FluObject {
|
||||
}
|
||||
Timer {
|
||||
id:delayTimer
|
||||
interval: duration; running: duration > 0; repeat: duration > 0
|
||||
interval: duration;
|
||||
running: duration > 0;
|
||||
repeat: duration > 0
|
||||
onTriggered: content.close();
|
||||
}
|
||||
FluLoader{
|
||||
@ -235,18 +238,26 @@ FluObject {
|
||||
}
|
||||
}
|
||||
function showSuccess(text,duration=1000,moremsg){
|
||||
mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
|
||||
return mcontrol.create(mcontrol.const_success,text,duration,moremsg ? moremsg : "");
|
||||
}
|
||||
function showInfo(text,duration=1000,moremsg){
|
||||
mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
|
||||
return mcontrol.create(mcontrol.const_info,text,duration,moremsg ? moremsg : "");
|
||||
}
|
||||
function showWarning(text,duration=1000,moremsg){
|
||||
mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
|
||||
return mcontrol.create(mcontrol.const_warning,text,duration,moremsg ? moremsg : "");
|
||||
}
|
||||
function showError(text,duration=1000,moremsg){
|
||||
mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
|
||||
return mcontrol.create(mcontrol.const_error,text,duration,moremsg ? moremsg : "");
|
||||
}
|
||||
function showCustom(itemcomponent,duration=1000){
|
||||
mcontrol.createCustom(itemcomponent,duration);
|
||||
return mcontrol.createCustom(itemcomponent,duration);
|
||||
}
|
||||
function clearAllInfo(){
|
||||
if(mcontrol.screenLayout != null) {
|
||||
mcontrol.screenLayout.destroy()
|
||||
mcontrol.screenLayout = null
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ import FluentUI
|
||||
ColumnLayout {
|
||||
default property alias buttons: control.data
|
||||
property int currentIndex : -1
|
||||
property bool disabled: false
|
||||
property bool manuallyDisabled: false
|
||||
id:control
|
||||
onCurrentIndexChanged: {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
@ -17,6 +19,12 @@ ColumnLayout {
|
||||
button.checked = true
|
||||
}
|
||||
}
|
||||
onDisabledChanged: {
|
||||
refreshButtonStatus()
|
||||
}
|
||||
onManuallyDisabledChanged: {
|
||||
refreshButtonStatus()
|
||||
}
|
||||
Component.onCompleted: {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
buttons[i].clickListener = function(){
|
||||
@ -28,6 +36,12 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
currentIndex = 0
|
||||
refreshButtonStatus()
|
||||
}
|
||||
|
||||
function refreshButtonStatus() {
|
||||
for(var i = 0;i<buttons.length;i++){
|
||||
if(!manuallyDisabled) buttons[i].enabled = !disabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -288,16 +288,19 @@ Window {
|
||||
loader_loading.sourceComponent = undefined
|
||||
}
|
||||
function showSuccess(text,duration,moremsg){
|
||||
info_bar.showSuccess(text,duration,moremsg)
|
||||
return info_bar.showSuccess(text,duration,moremsg)
|
||||
}
|
||||
function showInfo(text,duration,moremsg){
|
||||
info_bar.showInfo(text,duration,moremsg)
|
||||
return info_bar.showInfo(text,duration,moremsg)
|
||||
}
|
||||
function showWarning(text,duration,moremsg){
|
||||
info_bar.showWarning(text,duration,moremsg)
|
||||
return info_bar.showWarning(text,duration,moremsg)
|
||||
}
|
||||
function showError(text,duration,moremsg){
|
||||
info_bar.showError(text,duration,moremsg)
|
||||
return info_bar.showError(text,duration,moremsg)
|
||||
}
|
||||
function clearAllInfo(){
|
||||
return info_bar.clearAllInfo()
|
||||
}
|
||||
function moveWindowToDesktopCenter(){
|
||||
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
||||
|
Loading…
Reference in New Issue
Block a user