Skip to content

Commit

Permalink
Merge pull request #112 from PlayingKarrde/working
Browse files Browse the repository at this point in the history
Version 1.0 release
  • Loading branch information
PlayingKarrde authored Jun 11, 2020
2 parents 967473b + fd861f7 commit 07e30d8
Show file tree
Hide file tree
Showing 277 changed files with 4,846 additions and 4,596 deletions.
78 changes: 78 additions & 0 deletions GameDetails/Button.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import QtQuick 2.0

FocusScope {
id: root

property bool selected
property alias text: buttonlabel.text
property alias icon: buttonicon.source
property alias buttonWidth: container.width
property real buttonMargin: vpx(25)
width: container.width

signal activated
signal highlighted

Rectangle {
id: container

width: (buttonlabel.text !== "") ? buttonlabel.x + buttonlabel.contentWidth + buttonMargin : height
Behavior on width { NumberAnimation { duration: 100 } }
height: vpx(50)
color: selected ? theme.accent : "transparent"
radius: height/2
border.width: selected ? 0 : 2
border.color: "white"
opacity: selected ? 1 : 0.2

Image {
id: buttonicon

source: "../assets/images/icon_play.svg"
width: parent.height - vpx(30)
height: parent.height - vpx(30)
fillMode: Image.PreserveAspectFit
asynchronous: true
//opacity: selected ? 1 : 0.2
Behavior on opacity { NumberAnimation { duration: 100 } }
scale: selected ? 1.2 : 1
Behavior on scale { NumberAnimation { duration: 100 } }

property real iconMargin: (buttonlabel.text === "") ? vpx(15) : buttonMargin
anchors { left: parent.left; leftMargin: iconMargin }
//anchors.horizontalCenter: (buttonlabel.text === "") ? parent.horizontalCenter : parent.left
anchors.verticalCenter: parent.verticalCenter
}

Text {
id: buttonlabel

font.family: subtitleFont.name
font.pixelSize: vpx(16)
font.bold: true
color: theme.text
//opacity: selected ? 1 : 0.2
visible: text !== ""

anchors { left: buttonicon.right; leftMargin: vpx(15) }
anchors.verticalCenter: parent.verticalCenter
}
}

// Input handling
Keys.onPressed: {
if (api.keys.isAccept(event) && !event.isAutoRepeat) {
event.accepted = true;
activated();
}
}

// Mouse/touch functionality
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: { sfxNav.play(); highlighted(); }
onExited: {}
onClicked: activated();
}
}
Loading

0 comments on commit 07e30d8

Please sign in to comment.