Skip to content
This repository has been archived by the owner on Sep 13, 2018. It is now read-only.

Commit

Permalink
Made the StatusPage resizable
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Schilling committed Jun 15, 2015
1 parent 5d498ed commit 385273b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 27 deletions.
13 changes: 8 additions & 5 deletions example/qml/main/AttributeEdit.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ MouseArea {
property int allowedIncrease: 0
property int allowedDecrease: 0

clip: true
width: 110
height: 14 + (extended ? 30 : 0)

onClicked: extended = !extended

Column {
ColumnLayout {
spacing: 5

anchors.left: parent.left
anchors.right: parent.right

AttributeLabel {
id: label
value: {
Expand All @@ -39,10 +40,10 @@ MouseArea {
}

RowLayout {
anchors.left: parent.left
anchors.right: parent.right
spacing: 5

visible: attributeEdit.extended

BrownButton {
text: "-"
Layout.fillWidth: true
Expand All @@ -63,6 +64,8 @@ MouseArea {
++plannedChange;
}
}

Layout.fillWidth: true
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion example/qml/main/AttributeLabel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Item {
property alias name: nameLabel.text
property alias value: valueLabel.text

width: 110
anchors.left: parent.left
anchors.right: parent.right
height: 14

Rectangle {
Expand All @@ -14,6 +15,7 @@ Item {
anchors.bottom: parent.bottom
color: "#C39753"
}

Rectangle {
id: valueLabelBackground
height: 1
Expand All @@ -25,6 +27,7 @@ Item {
border.width: 1
color: "transparent"
}

Text {
id: nameLabel
font.pixelSize: 10
Expand All @@ -33,6 +36,7 @@ Item {
anchors.left: parent.left
anchors.right: valueLabelBackground.left
}

Text {
id: valueLabel
anchors.centerIn: valueLabelBackground
Expand Down
54 changes: 33 additions & 21 deletions example/qml/main/AttributeList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ GridLayout {
rowSpacing: 5
columnSpacing: 5

anchors.left: parent.left
anchors.right: parent.right

property int itemWidth: width / 2 - columnSpacing

property bool changesPlanned:
pointsToDistribute !== gameClient.attributePoints ||
pointsToCorrect !== gameClient.correctionPoints
Expand Down Expand Up @@ -83,20 +88,24 @@ GridLayout {

Layout.row: 0
Layout.column: 0
Layout.preferredWidth: width
Layout.preferredWidth: parent.itemWidth
Layout.preferredHeight: height
}

AttributeLabel {
name: qsTr("Damage")
value: {
var base = playerAttributes.damage;
var min = Math.round(base);
var max = Math.round(base + playerAttributes.damageDelta);
return min + "-" + max;
ColumnLayout {
AttributeLabel {
name: qsTr("Damage")
value: {
var base = playerAttributes.damage;
var min = Math.round(base);
var max = Math.round(base + playerAttributes.damageDelta);
return min + "-" + max;
}
}

Layout.row: 0
Layout.column: 1
Layout.preferredWidth: parent.itemWidth
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}

Expand All @@ -110,12 +119,12 @@ GridLayout {

Layout.row: 1
Layout.column: 0
Layout.preferredWidth: width
Layout.preferredWidth: parent.itemWidth
Layout.preferredHeight: height
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}

Column {
ColumnLayout {
spacing: 5

AttributeLabel {
Expand All @@ -130,7 +139,7 @@ GridLayout {

Layout.row: 1
Layout.column: 1
Layout.fillWidth: true
Layout.preferredWidth: parent.itemWidth
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}

Expand All @@ -144,17 +153,20 @@ GridLayout {

Layout.row: 3
Layout.column: 0
Layout.preferredWidth: width
Layout.preferredWidth: parent.itemWidth
Layout.preferredHeight: height
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}

AttributeLabel {
name: qsTr("Hit chance")
value: limitPrecision(playerAttributes.hitChance, 1)
ColumnLayout {
AttributeLabel {
name: qsTr("Hit chance")
value: limitPrecision(playerAttributes.hitChance, 1)
}

Layout.row: 3
Layout.column: 1
Layout.fillWidth: true
Layout.preferredWidth: parent.itemWidth
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}

Expand All @@ -168,12 +180,12 @@ GridLayout {

Layout.row: 4
Layout.column: 0
Layout.preferredWidth: width
Layout.preferredWidth: parent.itemWidth
Layout.preferredHeight: height
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}

Column {
ColumnLayout {
spacing: 5

AttributeLabel {
Expand All @@ -193,7 +205,7 @@ GridLayout {

Layout.row: 4
Layout.column: 1
Layout.fillWidth: true
Layout.preferredWidth: parent.itemWidth
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}

Expand All @@ -207,7 +219,7 @@ GridLayout {

Layout.row: 7
Layout.column: 0
Layout.preferredWidth: width
Layout.preferredWidth: parent.itemWidth
Layout.preferredHeight: height
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}
Expand All @@ -222,7 +234,7 @@ GridLayout {

Layout.row: 8
Layout.column: 0
Layout.preferredWidth: width
Layout.preferredWidth: parent.itemWidth
Layout.preferredHeight: height
Layout.alignment: Qt.AlignLeft | Qt.AlignTop;
}
Expand Down

0 comments on commit 385273b

Please sign in to comment.