Improve QML syntax and update license headers.

This commit is contained in:
Filippo Scognamiglio
2021-06-30 22:49:03 +02:00
parent 205a152350
commit 701cb540e5
29 changed files with 1119 additions and 942 deletions

View File

@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013 "Filippo Scognamiglio"
* Copyright (c) 2013-2021 "Filippo Scognamiglio"
* https://github.com/Swordfish90/cool-retro-term
*
* This file is part of cool-retro-term.
@@ -17,7 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.1
@@ -32,41 +31,42 @@ RowLayout {
property alias max_value: slider.to
property alias stepSize: slider.stepSize
signal newValue(real newValue);
signal newValue(real newValue)
id: setting_component
Layout.fillWidth: true
onValueChanged: {
check.checked = !(value == 0);
if(check.checked)
slider.value = value;
check.checked = !(value == 0)
if (check.checked)
slider.value = value
}
CheckBox{
CheckBox {
id: check
implicitWidth: 160
onClicked: {
if(!checked){
checked = false;
slider.enabled = false;
newValue(0);
if (!checked) {
checked = false
slider.enabled = false
newValue(0)
} else {
checked = true;
newValue(slider.value);
slider.enabled = true;
checked = true
newValue(slider.value)
slider.enabled = true
}
}
}
Slider{
Slider {
id: slider
stepSize: parent.stepSize
Layout.fillWidth: true
onValueChanged: {
newValue(value);
newValue(value)
}
}
SizedLabel {
text: Math.round(((value - min_value) / (max_value - min_value)) * 100) + "%"
text: Math.round(
((value - min_value) / (max_value - min_value)) * 100) + "%"
}
}