Use attached Layout attached properties to set tool button size

This commit is contained in:
Cameron Gutman 2021-12-03 12:24:31 +03:00
parent fac4c85133
commit 1444ba2c35
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
ToolButton { ToolButton {
property string iconSource property string iconSource
@ -20,8 +21,7 @@ ToolButton {
// This determines the size of the Material highlight. We increase it // This determines the size of the Material highlight. We increase it
// from the default because we use larger than normal icons for TV readability. // from the default because we use larger than normal icons for TV readability.
background.width: (parent.height - parent.anchors.bottomMargin - parent.anchors.topMargin) * 0.60 Layout.preferredHeight: parent.height
background.height: (parent.height - parent.anchors.bottomMargin - parent.anchors.topMargin) * 0.60
Keys.onReturnPressed: { Keys.onReturnPressed: {
clicked() clicked()

View File

@ -215,7 +215,7 @@ ApplicationWindow {
} }
RowLayout { RowLayout {
spacing: 20 spacing: 10
anchors.leftMargin: 10 anchors.leftMargin: 10
anchors.rightMargin: 10 anchors.rightMargin: 10
anchors.fill: parent anchors.fill: parent