try harder to avoid scroll buttons
also event copmpress the relayout
This commit is contained in:
parent
9c600c5d68
commit
9cac91b652
@ -217,6 +217,7 @@ FocusScope {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: buttonsLayout
|
id: buttonsLayout
|
||||||
rows: 1
|
rows: 1
|
||||||
|
@ -88,7 +88,7 @@ Item {
|
|||||||
signal clicked
|
signal clicked
|
||||||
|
|
||||||
implicitWidth: Math.max(label.implicitWidth + (internal.portrait ? 0 : (iconSource != null ? units.iconSizes.small : 0)), height)
|
implicitWidth: Math.max(label.implicitWidth + (internal.portrait ? 0 : (iconSource != null ? units.iconSizes.small : 0)), height)
|
||||||
implicitHeight: label.implicitHeight + (internal.portrait ? (iconSource != null ? units.iconSizes.small : 0) : 0)
|
implicitHeight: 20//label.implicitHeight + (internal.portrait ? (iconSource != null ? units.iconSizes.small : 0) : 0)
|
||||||
|
|
||||||
opacity: enabled ? 1 : 0.6
|
opacity: enabled ? 1 : 0.6
|
||||||
//long notation to not make it overwritten by implementations
|
//long notation to not make it overwritten by implementations
|
||||||
|
@ -65,10 +65,10 @@ Item {
|
|||||||
|
|
||||||
property bool isHorizontal: (tabPosition != Qt.LeftEdge && tabPosition != Qt.RightEdge)
|
property bool isHorizontal: (tabPosition != Qt.LeftEdge && tabPosition != Qt.RightEdge)
|
||||||
|
|
||||||
Component.onCompleted: priv.layoutChildren()
|
Component.onCompleted: layoutTimer.restart()
|
||||||
onChildrenChanged: priv.layoutChildren()
|
onChildrenChanged: layoutTimer.restart()
|
||||||
onWidthChanged: priv.layoutChildren()
|
onWidthChanged: layoutTimer.restart()
|
||||||
onHeightChanged: priv.layoutChildren()
|
onHeightChanged: layoutTimer.restart()
|
||||||
|
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
@ -85,6 +85,11 @@ Item {
|
|||||||
|
|
||||||
focus: true
|
focus: true
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: layoutTimer
|
||||||
|
interval: 150
|
||||||
|
onTriggered: priv.layoutChildren()
|
||||||
|
}
|
||||||
MouseEventListener {
|
MouseEventListener {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onWheelMoved: {
|
onWheelMoved: {
|
||||||
@ -179,8 +184,8 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var maxAllowedSize = theme.mSize(theme.defaultFont).width * 14
|
var maxAllowedSize = theme.mSize(theme.defaultFont).width * 14
|
||||||
var itemWidth = (root.width - (visibleChildCount-1)*10) / visibleChildCount
|
var itemWidth = Math.min(maxAllowedSize, (root.width - (visibleChildCount-1)*10) / visibleChildCount)
|
||||||
var itemHeight = (root.height - (visibleChildCount-1)*10) / visibleChildCount
|
var itemHeight = Math.min(maxAllowedSize, (root.height - (visibleChildCount-1)*10) / visibleChildCount)
|
||||||
|
|
||||||
var itemIndex = mirrored ? childCount - 1 : 0
|
var itemIndex = mirrored ? childCount - 1 : 0
|
||||||
var increment = mirrored ? - 1 : 1
|
var increment = mirrored ? - 1 : 1
|
||||||
@ -205,7 +210,7 @@ Item {
|
|||||||
|
|
||||||
contentWidth = Math.max(contentWidth, (child.implicitWidth + buttonFrame.margins.left + buttonFrame.margins.right));
|
contentWidth = Math.max(contentWidth, (child.implicitWidth + buttonFrame.margins.left + buttonFrame.margins.right));
|
||||||
|
|
||||||
contentHeight = Math.max(contentHeight, (maxChildSize + buttonFrame.margins.top + buttonFrame.margins.bottom) * childCount);
|
contentHeight = Math.max(contentHeight, maxChildSize * childCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Horizontal
|
//Horizontal
|
||||||
@ -218,7 +223,7 @@ Item {
|
|||||||
|
|
||||||
if (child.implicitWidth != undefined) {
|
if (child.implicitWidth != undefined) {
|
||||||
maxChildSize = Math.max(maxChildSize, Math.min(maxAllowedSize, child.implicitWidth))
|
maxChildSize = Math.max(maxChildSize, Math.min(maxAllowedSize, child.implicitWidth))
|
||||||
contentWidth = Math.max(contentWidth, (maxChildSize + buttonFrame.margins.left + buttonFrame.margins.right) * childCount)
|
contentWidth = Math.max(contentWidth, maxChildSize * childCount)
|
||||||
contentHeight = Math.max(contentHeight, (child.implicitHeight + buttonFrame.margins.top + buttonFrame.margins.bottom))
|
contentHeight = Math.max(contentHeight, (child.implicitHeight + buttonFrame.margins.top + buttonFrame.margins.bottom))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user