Move ValueButton and height-awareness to Setting

This commit is contained in:
Anton Thomasson 2020-11-23 20:57:02 +01:00
parent 77628cf944
commit 6e22c4ad76
5 changed files with 13 additions and 33 deletions

View file

@ -4,8 +4,6 @@ import seaprint.convertchecker 1.0
import "../pages/utils.js" as Utils
Setting {
height: button.height + menu.height
property var choices
property string mime_type
@ -13,13 +11,7 @@ Setting {
property int num_large_choices: 8
ValueButton {
id: button
enabled: valid
label: prettyName
value: Utils.ippName(name, choice ? choice : default_choice)
onClicked: parent.clicked()
}
displayValue: Utils.ippName(name, choice ? choice : default_choice)
onClicked: {
if(limited_choices.length>num_large_choices)

View file

@ -5,13 +5,7 @@ Setting {
property int low
property int high
ValueButton {
id: button
enabled: valid
label: prettyName
value: choice ? choice : default_choice
onClicked: parent.clicked()
}
displayValue: choice ? choice : default_choice
menu: ContextMenu {
enabled: valid

View file

@ -5,7 +5,6 @@ import seaprint.ippmsg 1.0
import "../pages/utils.js" as Utils
Setting {
height: button.height + menu.height
property var printer
Component.onCompleted: {
@ -18,13 +17,7 @@ Setting {
}
}
ValueButton {
id: button
enabled: valid
label: prettyName
value: choice ? qsTr("true") : qsTr("false")
onClicked: parent.clicked()
}
displayValue: choice ? qsTr("true") : qsTr("false")
menu: ContextMenu {
id: menu

View file

@ -2,8 +2,6 @@ import QtQuick 2.0
import Sailfish.Silica 1.0
Setting {
height: button.height + menu.height
property int high
property int choice_low: 1
property int choice_high: 0
@ -34,13 +32,7 @@ Setting {
}
}
ValueButton {
id: button
enabled: valid
label: prettyName
value: choice_high==0 ? qsTr("all") : ""+choice_low+" - "+choice_high
onClicked: parent.clicked()
}
displayValue: choice_high==0 ? qsTr("all") : ""+choice_low+" - "+choice_high
menu: ContextMenu {
enabled: valid

View file

@ -2,6 +2,7 @@ import QtQuick 2.0
import Sailfish.Silica 1.0
Item {
height: button.height + menu.height
width: parent.width
property string name
@ -15,6 +16,14 @@ Item {
signal clicked()
onClicked: menu.open(this)
property alias displayValue: button.value
ValueButton {
id: button
enabled: valid
label: prettyName
onClicked: parent.clicked()
}
property var menu
}