Compare commits

...

5 Commits

Author SHA1 Message Date
朱子楚\zhuzi
e6c4b79298 Merge branch 'main' into 1.7.6-dev
# Conflicts:
#	src/Qt5/imports/FluentUI/Controls/FluRadioButtons.qml
#	src/Qt6/imports/FluentUI/Controls/FluRadioButtons.qml
2024-05-10 12:26:14 +08:00
朱子楚\zhuzi
f830d5a9bf Merge branch 'main' of https://github.com/zhuzichu520/FluentUI 2024-05-09 19:41:15 +08:00
zhuzichu
ed49e3f6af
Merge pull request #499 from gao-xiangyang/main
info提示语支持主动调用函数关闭,支持关闭所有info框的函数
2024-05-09 17:10:34 +05:30
gaoxiangyang
9aa6615189 FluRadioButtons 组件支持 disabled、manuallyDisabled选项
disabled: true // 禁用所有FluRadioButton子组件
        manuallyDisabled: true // 是否指定每个FluRadioButton上的disabled选项
2024-05-08 21:10:00 +08:00
gaoxiangyang
c36515f19c info提示语支持主动调用函数关闭,支持关闭所有info框的函数 2024-05-08 20:35:31 +08:00
11 changed files with 311 additions and 101 deletions

View File

@ -1273,19 +1273,19 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
</message>
<message>
<location filename="qml/page/T_GroupBox.qml" line="17"/>
<location filename="qml/page/T_GroupBox.qml" line="27"/>
<location filename="qml/page/T_GroupBox.qml" line="35"/>
<source>E-mail</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_GroupBox.qml" line="18"/>
<location filename="qml/page/T_GroupBox.qml" line="28"/>
<location filename="qml/page/T_GroupBox.qml" line="36"/>
<source>Calendar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_GroupBox.qml" line="19"/>
<location filename="qml/page/T_GroupBox.qml" line="29"/>
<location filename="qml/page/T_GroupBox.qml" line="37"/>
<source>Contacts</source>
<translation type="unfinished"></translation>
</message>
@ -1295,6 +1295,11 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<oldsource>RadioButton Group111111111111111111111111</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_GroupBox.qml" line="46"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>T_Home</name>
@ -1358,46 +1363,77 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="23"/>
<location filename="qml/page/T_InfoBar.qml" line="27"/>
<source>Info</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="25"/>
<location filename="qml/page/T_InfoBar.qml" line="49"/>
<location filename="qml/page/T_InfoBar.qml" line="29"/>
<location filename="qml/page/T_InfoBar.qml" line="53"/>
<source>This is an InfoBar in the Info Style</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="29"/>
<location filename="qml/page/T_InfoBar.qml" line="33"/>
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="31"/>
<location filename="qml/page/T_InfoBar.qml" line="35"/>
<source>This is an InfoBar in the Warning Style</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="37"/>
<location filename="qml/page/T_InfoBar.qml" line="41"/>
<source>This is an InfoBar in the Error Style</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="43"/>
<location filename="qml/page/T_InfoBar.qml" line="47"/>
<source>This is an InfoBar in the Success Style</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="47"/>
<location filename="qml/page/T_InfoBar.qml" line="51"/>
<source>InfoBar that needs to be turned off manually</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="49"/>
<location filename="qml/page/T_InfoBar.qml" line="53"/>
<source>Manual shutdown is supported</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="59"/>
<source>Manually close the info message box</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="64"/>
<location filename="qml/page/T_InfoBar.qml" line="74"/>
<location filename="qml/page/T_InfoBar.qml" line="84"/>
<source>close &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="64"/>
<location filename="qml/page/T_InfoBar.qml" line="74"/>
<location filename="qml/page/T_InfoBar.qml" line="84"/>
<source>show &apos;%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="70"/>
<location filename="qml/page/T_InfoBar.qml" line="80"/>
<location filename="qml/page/T_InfoBar.qml" line="90"/>
<source>This is an &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="94"/>
<source>clear all info</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>T_LineChart</name>
@ -1700,30 +1736,30 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
</message>
<message>
<location filename="qml/page/T_RadioButton.qml" line="38"/>
<location filename="qml/page/T_RadioButton.qml" line="81"/>
<location filename="qml/page/T_RadioButton.qml" line="134"/>
<location filename="qml/page/T_RadioButton.qml" line="187"/>
<location filename="qml/page/T_RadioButton.qml" line="79"/>
<location filename="qml/page/T_RadioButton.qml" line="130"/>
<location filename="qml/page/T_RadioButton.qml" line="181"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_RadioButton.qml" line="64"/>
<location filename="qml/page/T_RadioButton.qml" line="117"/>
<location filename="qml/page/T_RadioButton.qml" line="170"/>
<location filename="qml/page/T_RadioButton.qml" line="115"/>
<location filename="qml/page/T_RadioButton.qml" line="166"/>
<source>Radio Button_1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_RadioButton.qml" line="68"/>
<location filename="qml/page/T_RadioButton.qml" line="121"/>
<location filename="qml/page/T_RadioButton.qml" line="174"/>
<location filename="qml/page/T_RadioButton.qml" line="67"/>
<location filename="qml/page/T_RadioButton.qml" line="118"/>
<location filename="qml/page/T_RadioButton.qml" line="169"/>
<source>Radio Button_2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_RadioButton.qml" line="72"/>
<location filename="qml/page/T_RadioButton.qml" line="125"/>
<location filename="qml/page/T_RadioButton.qml" line="178"/>
<location filename="qml/page/T_RadioButton.qml" line="70"/>
<location filename="qml/page/T_RadioButton.qml" line="121"/>
<location filename="qml/page/T_RadioButton.qml" line="172"/>
<source>Radio Button_3</source>
<translation type="unfinished"></translation>
</message>

View File

@ -1359,19 +1359,19 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
</message>
<message>
<location filename="qml/page/T_GroupBox.qml" line="17"/>
<location filename="qml/page/T_GroupBox.qml" line="27"/>
<location filename="qml/page/T_GroupBox.qml" line="35"/>
<source>E-mail</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_GroupBox.qml" line="18"/>
<location filename="qml/page/T_GroupBox.qml" line="28"/>
<location filename="qml/page/T_GroupBox.qml" line="36"/>
<source>Calendar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_GroupBox.qml" line="19"/>
<location filename="qml/page/T_GroupBox.qml" line="29"/>
<location filename="qml/page/T_GroupBox.qml" line="37"/>
<source>Contacts</source>
<translation type="unfinished"></translation>
</message>
@ -1381,6 +1381,11 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<oldsource>RadioButton Group111111111111111111111111</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_GroupBox.qml" line="46"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>T_Home</name>
@ -1452,46 +1457,77 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="23"/>
<location filename="qml/page/T_InfoBar.qml" line="27"/>
<source>Info</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="25"/>
<location filename="qml/page/T_InfoBar.qml" line="49"/>
<location filename="qml/page/T_InfoBar.qml" line="29"/>
<location filename="qml/page/T_InfoBar.qml" line="53"/>
<source>This is an InfoBar in the Info Style</source>
<translation type="unfinished">Info样式的信息栏</translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="29"/>
<location filename="qml/page/T_InfoBar.qml" line="33"/>
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="31"/>
<location filename="qml/page/T_InfoBar.qml" line="35"/>
<source>This is an InfoBar in the Warning Style</source>
<translation type="unfinished">Warning样式的信息栏</translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="37"/>
<location filename="qml/page/T_InfoBar.qml" line="41"/>
<source>This is an InfoBar in the Error Style</source>
<translation type="unfinished">Error样式的信息栏</translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="43"/>
<location filename="qml/page/T_InfoBar.qml" line="47"/>
<source>This is an InfoBar in the Success Style</source>
<translation type="unfinished">Success样式的信息栏</translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="47"/>
<location filename="qml/page/T_InfoBar.qml" line="51"/>
<source>InfoBar that needs to be turned off manually</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="49"/>
<location filename="qml/page/T_InfoBar.qml" line="53"/>
<source>Manual shutdown is supported</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="59"/>
<source>Manually close the info message box</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="64"/>
<location filename="qml/page/T_InfoBar.qml" line="74"/>
<location filename="qml/page/T_InfoBar.qml" line="84"/>
<source>close &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="64"/>
<location filename="qml/page/T_InfoBar.qml" line="74"/>
<location filename="qml/page/T_InfoBar.qml" line="84"/>
<source>show &apos;%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="70"/>
<location filename="qml/page/T_InfoBar.qml" line="80"/>
<location filename="qml/page/T_InfoBar.qml" line="90"/>
<source>This is an &apos;%1&apos;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_InfoBar.qml" line="94"/>
<source>clear all info</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Loading...</source>
<translation type="obsolete">...</translation>
@ -1808,30 +1844,30 @@ My only desire is to be permitted to drive out the traitors and restore the Han.
</message>
<message>
<location filename="qml/page/T_RadioButton.qml" line="38"/>
<location filename="qml/page/T_RadioButton.qml" line="81"/>
<location filename="qml/page/T_RadioButton.qml" line="134"/>
<location filename="qml/page/T_RadioButton.qml" line="187"/>
<location filename="qml/page/T_RadioButton.qml" line="79"/>
<location filename="qml/page/T_RadioButton.qml" line="130"/>
<location filename="qml/page/T_RadioButton.qml" line="181"/>
<source>Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_RadioButton.qml" line="64"/>
<location filename="qml/page/T_RadioButton.qml" line="117"/>
<location filename="qml/page/T_RadioButton.qml" line="170"/>
<location filename="qml/page/T_RadioButton.qml" line="115"/>
<location filename="qml/page/T_RadioButton.qml" line="166"/>
<source>Radio Button_1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_RadioButton.qml" line="68"/>
<location filename="qml/page/T_RadioButton.qml" line="121"/>
<location filename="qml/page/T_RadioButton.qml" line="174"/>
<location filename="qml/page/T_RadioButton.qml" line="67"/>
<location filename="qml/page/T_RadioButton.qml" line="118"/>
<location filename="qml/page/T_RadioButton.qml" line="169"/>
<source>Radio Button_2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="qml/page/T_RadioButton.qml" line="72"/>
<location filename="qml/page/T_RadioButton.qml" line="125"/>
<location filename="qml/page/T_RadioButton.qml" line="178"/>
<location filename="qml/page/T_RadioButton.qml" line="70"/>
<location filename="qml/page/T_RadioButton.qml" line="121"/>
<location filename="qml/page/T_RadioButton.qml" line="172"/>
<source>Radio Button_3</source>
<translation type="unfinished"></translation>
</message>

View File

@ -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 // FluRadioButtondisabled
FluRadioButton { text: qsTr("E-mail") }
FluRadioButton { text: qsTr("Calendar") }
FluRadioButton { text: qsTr("Contacts") }
}
}
`
}
}

View File

@ -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()
`
}
}

View File

@ -53,6 +53,7 @@ FluScrollablePage{
Layout.topMargin: 20
FluRadioButtons{
spacing: 8
disabled: radio_button_switch2.checked
anchors.verticalCenter: parent.verticalCenter
anchors{
verticalCenter: parent.verticalCenter
@ -60,15 +61,12 @@ FluScrollablePage{
}
currentIndex: 1
FluRadioButton{
disabled: radio_button_switch2.checked
text: qsTr("Radio Button_1")
}
FluRadioButton{
disabled: radio_button_switch2.checked
text: qsTr("Radio Button_2")
}
FluRadioButton{
disabled: radio_button_switch2.checked
text: qsTr("Radio Button_3")
}
}
@ -110,18 +108,16 @@ FluScrollablePage{
verticalCenter: parent.verticalCenter
left: parent.left
}
disabled: radio_button_switch3.checked
orientation: Qt.Horizontal
currentIndex: 1
FluRadioButton{
disabled: radio_button_switch3.checked
text: qsTr("Radio Button_1")
}
FluRadioButton{
disabled: radio_button_switch3.checked
text: qsTr("Radio Button_2")
}
FluRadioButton{
disabled: radio_button_switch3.checked
text: qsTr("Radio Button_3")
}
}
@ -164,17 +160,15 @@ FluScrollablePage{
verticalCenter: parent.verticalCenter
left: parent.left
}
disabled: radio_button_switch4.checked
currentIndex: -1
FluCheckBox{
disabled: radio_button_switch4.checked
text: qsTr("Radio Button_1")
}
FluCheckBox{
disabled: radio_button_switch4.checked
text: qsTr("Radio Button_2")
}
FluCheckBox{
disabled: radio_button_switch4.checked
text: qsTr("Radio Button_3")
}
}

View File

@ -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
}
}

View File

@ -9,6 +9,8 @@ Item{
property int currentIndex : -1
property int spacing: 8
property int orientation: Qt.Vertical
property bool disabled: false
property bool manuallyDisabled: false
QtObject{
id: d
function updateChecked(){
@ -22,12 +24,23 @@ Item{
buttons[currentIndex].checked = true
}
}
function refreshButtonStatus() {
for(var i = 0;i<buttons.length;i++){
if(!manuallyDisabled) buttons[i].enabled = !disabled
}
}
}
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
onCurrentIndexChanged: {
d.updateChecked()
}
onDisabledChanged: {
d.refreshButtonStatus()
}
onManuallyDisabledChanged: {
d.refreshButtonStatus()
}
Component{
id:com_vertical
ColumnLayout {
@ -45,6 +58,7 @@ Item{
}
}
d.updateChecked()
d.refreshButtonStatus()
}
}
}
@ -65,6 +79,7 @@ Item{
}
}
d.updateChecked()
d.refreshButtonStatus()
}
}
}

View File

@ -299,16 +299,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(){
var availableGeometry = FluTools.desktopAvailableGeometry(window)

View File

@ -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
}
}

View File

@ -10,6 +10,8 @@ Item{
property int currentIndex : -1
property int spacing: 8
property int orientation: Qt.Vertical
property bool disabled: false
property bool manuallyDisabled: false
QtObject{
id: d
function updateChecked(){
@ -23,12 +25,23 @@ Item{
buttons[currentIndex].checked = true
}
}
function refreshButtonStatus() {
for(var i = 0;i<buttons.length;i++){
if(!manuallyDisabled) buttons[i].enabled = !disabled
}
}
}
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
onCurrentIndexChanged: {
d.updateChecked()
}
onDisabledChanged: {
d.refreshButtonStatus()
}
onManuallyDisabledChanged: {
d.refreshButtonStatus()
}
Component{
id:com_vertical
ColumnLayout {
@ -46,6 +59,7 @@ Item{
}
}
d.updateChecked()
d.refreshButtonStatus()
}
}
}
@ -66,6 +80,7 @@ Item{
}
}
d.updateChecked()
d.refreshButtonStatus()
}
}
}

View File

@ -298,16 +298,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(){
var availableGeometry = FluTools.desktopAvailableGeometry(window)