3 Star 4 Fork 2

邱海/动态桌面-UbuntuKyLin-优麒麟-桌宠

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Config.qml 5.08 KB
一键复制 编辑 原始数据 按行查看 历史
qiuhai 提交于 2021-09-06 14:39 . 添加笔记本
/*
* Copyright (c) 2021 黄川
* "Live2d桌宠桌面秀——桌面背景管理工具" is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
import QtQuick 2.0
import QtQuick 2.12
import QtQuick.Window 2.2
import QtQuick.Controls 2.15
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.15
import com.mycompany.start 1.0
Window{
title: "设置"
property real modelSize: 1.0 //用于保存模型大小比例,范围为0.8-1.5,默认为1
signal iconChange()
signal modelSizeChange()
StartOnBegin{
id:startOnBegin
}
property bool iconShow: true
function defaultSetting(){
if (iconShow){
control.checked = true
}
if(startOnBegin.isOpenStart()){
isStartControl.checked = true;
}
}
function controlContent(){
if(control.position == 0){
return "显示桌面图标";
} else {
return "隐藏桌面图标";
}
}
function isStartContent(){
if(isStartControl.position == 0){
return "开机自启:关";
} else{
return "开机自启:开";
}
}
id:config
x:Screen.width / 2 - width /2
y:Screen.height /2 - height /2
width: 250
height: 210
minimumWidth: width
maximumWidth: width
minimumHeight: height
maximumHeight: height
visible:false
Component.onCompleted: { //加载后进行初始化
defaultSetting()
modelSizeSlider.value = modelSize
// if (iconShow) control.position = 1
// else control.position = 0
}
Column{
id:configClumn
spacing: 10
width: parent.width * 4/5
anchors.centerIn: parent
height: parent.height
Row{
id:modelSizeSetting
height: parent.height /4
width: configClumn.width
spacing: height /20
anchors.horizontalCenter: parent.horizontalCenter
Text{
font.pixelSize: 13
width: parent.width *1/3
anchors.verticalCenter: parent.verticalCenter
verticalAlignment:Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text:qsTr("模型大小:")
}
Slider{
id:modelSizeSlider
width: modelSizeSetting.width * 1 / 2
anchors.verticalCenter: parent.verticalCenter
from:0.8
to:1.5
value:modelSize
onValueChanged: { //数值改变时自动更新到modelSize
modelSize=value;
modelSizeChange()
}
}
Text {
id: slidervalue
text: modelSizeSlider.value.toFixed(2)
font.pixelSize: 12
anchors.verticalCenter: parent.verticalCenter
verticalAlignment:Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
}
}
RowLayout{
id:iconTypeShow
height: parent.height /4
width: configClumn.width
spacing: height /20
anchors.horizontalCenter: parent.horizontalCenter
Text {
id:iconConfigText
font.pixelSize: 15
width: parent.width *2/5
verticalAlignment:Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr(controlContent())
}
Switch{
id:control
position: 0
width: parent.width * 2 / 5
onPositionChanged: {
iconShow = control.position
config.iconChange()
}
}
}
RowLayout{
id:isStart
height: parent.height /4
width: configClumn.width
spacing: height /20
anchors.horizontalCenter: parent.horizontalCenter
Text {
id:isStartText
font.pixelSize: 15
width: parent.width *2/5
verticalAlignment:Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
text: qsTr(isStartContent())
}
Switch{
id:isStartControl
position: 0
width: parent.width * 2 / 5
onPositionChanged: {
if (isStartControl.position == 1){
startOnBegin.start()
} else {
startOnBegin.unStart()
}
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
QML
1
https://gitee.com/qiuhai182/desk-show-linux-ubuntu-kylin.git
git@gitee.com:qiuhai182/desk-show-linux-ubuntu-kylin.git
qiuhai182
desk-show-linux-ubuntu-kylin
动态桌面-UbuntuKyLin-优麒麟-桌宠
master

搜索帮助