Move ValueButton and height-awareness to Setting
This commit is contained in:
parent
77628cf944
commit
6e22c4ad76
5 changed files with 13 additions and 33 deletions
|
@ -4,8 +4,6 @@ import seaprint.convertchecker 1.0
|
||||||
import "../pages/utils.js" as Utils
|
import "../pages/utils.js" as Utils
|
||||||
|
|
||||||
Setting {
|
Setting {
|
||||||
height: button.height + menu.height
|
|
||||||
|
|
||||||
property var choices
|
property var choices
|
||||||
property string mime_type
|
property string mime_type
|
||||||
|
|
||||||
|
@ -13,13 +11,7 @@ Setting {
|
||||||
|
|
||||||
property int num_large_choices: 8
|
property int num_large_choices: 8
|
||||||
|
|
||||||
ValueButton {
|
displayValue: Utils.ippName(name, choice ? choice : default_choice)
|
||||||
id: button
|
|
||||||
enabled: valid
|
|
||||||
label: prettyName
|
|
||||||
value: Utils.ippName(name, choice ? choice : default_choice)
|
|
||||||
onClicked: parent.clicked()
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(limited_choices.length>num_large_choices)
|
if(limited_choices.length>num_large_choices)
|
||||||
|
|
|
@ -5,13 +5,7 @@ Setting {
|
||||||
property int low
|
property int low
|
||||||
property int high
|
property int high
|
||||||
|
|
||||||
ValueButton {
|
displayValue: choice ? choice : default_choice
|
||||||
id: button
|
|
||||||
enabled: valid
|
|
||||||
label: prettyName
|
|
||||||
value: choice ? choice : default_choice
|
|
||||||
onClicked: parent.clicked()
|
|
||||||
}
|
|
||||||
|
|
||||||
menu: ContextMenu {
|
menu: ContextMenu {
|
||||||
enabled: valid
|
enabled: valid
|
||||||
|
|
|
@ -5,7 +5,6 @@ import seaprint.ippmsg 1.0
|
||||||
import "../pages/utils.js" as Utils
|
import "../pages/utils.js" as Utils
|
||||||
|
|
||||||
Setting {
|
Setting {
|
||||||
height: button.height + menu.height
|
|
||||||
property var printer
|
property var printer
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
@ -18,13 +17,7 @@ Setting {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueButton {
|
displayValue: choice ? qsTr("true") : qsTr("false")
|
||||||
id: button
|
|
||||||
enabled: valid
|
|
||||||
label: prettyName
|
|
||||||
value: choice ? qsTr("true") : qsTr("false")
|
|
||||||
onClicked: parent.clicked()
|
|
||||||
}
|
|
||||||
|
|
||||||
menu: ContextMenu {
|
menu: ContextMenu {
|
||||||
id: menu
|
id: menu
|
||||||
|
|
|
@ -2,8 +2,6 @@ import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
|
|
||||||
Setting {
|
Setting {
|
||||||
height: button.height + menu.height
|
|
||||||
|
|
||||||
property int high
|
property int high
|
||||||
property int choice_low: 1
|
property int choice_low: 1
|
||||||
property int choice_high: 0
|
property int choice_high: 0
|
||||||
|
@ -34,13 +32,7 @@ Setting {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ValueButton {
|
displayValue: choice_high==0 ? qsTr("all") : ""+choice_low+" - "+choice_high
|
||||||
id: button
|
|
||||||
enabled: valid
|
|
||||||
label: prettyName
|
|
||||||
value: choice_high==0 ? qsTr("all") : ""+choice_low+" - "+choice_high
|
|
||||||
onClicked: parent.clicked()
|
|
||||||
}
|
|
||||||
|
|
||||||
menu: ContextMenu {
|
menu: ContextMenu {
|
||||||
enabled: valid
|
enabled: valid
|
||||||
|
|
|
@ -2,6 +2,7 @@ import QtQuick 2.0
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
height: button.height + menu.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
property string name
|
property string name
|
||||||
|
@ -15,6 +16,14 @@ Item {
|
||||||
signal clicked()
|
signal clicked()
|
||||||
onClicked: menu.open(this)
|
onClicked: menu.open(this)
|
||||||
|
|
||||||
|
property alias displayValue: button.value
|
||||||
|
|
||||||
|
ValueButton {
|
||||||
|
id: button
|
||||||
|
enabled: valid
|
||||||
|
label: prettyName
|
||||||
|
onClicked: parent.clicked()
|
||||||
|
}
|
||||||
property var menu
|
property var menu
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue