add close button

This commit is contained in:
Anika Raemer 2021-03-13 17:06:39 +01:00
parent 693078b892
commit 5d5e3c6888
6 changed files with 56 additions and 30 deletions

View file

@ -16,6 +16,17 @@ Item{
} }
} }
RoundButton{
id: closeApp
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: container.margins
imageSource: "qrc:/icon_close"
onClicked: {
Qt.quit();
}
}
Rectangle{ Rectangle{
id: coverBorder id: coverBorder
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter

View file

@ -4,18 +4,31 @@ import QtQuick 2.0
* @brief Navigation view containing list view displaying artists or genres and albums * @brief Navigation view containing list view displaying artists or genres and albums
*/ */
Item { Item {
id: container
property int margins: 20
RoundButton{ RoundButton{
id: back id: back
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.margins: 20 anchors.margins: container.margins
visible: navigationList.pIsBackVisible visible: navigationList.pIsBackVisible
onClicked: navigationList.navigateBack(); onClicked: navigationList.navigateBack();
} // RoundButton: navigate back } // RoundButton: navigate back
RoundButton{
id: closeApp
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: container.margins
imageSource: "qrc:/icon_close"
onClicked: {
Qt.quit();
}
} // RoundButton: closeApp
Rectangle{ Rectangle{
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View file

@ -1,41 +1,40 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 2.4
Rectangle { /**
* @brief Round button containing an image
*/
Button {
id: container id: container
property alias imageSource: image.source property alias imageSource: image.source
signal clicked();
border.width: 2 background: Rectangle{
border.color: "grey"
color: "white" border.width: 2
border.color: "grey"
width: 65 color: "white"
height: width
radius: width/2
Image{ implicitWidth: 65
id: image implicitHeight: width
anchors.centerIn: parent radius: width/2
width: 30
height: width
source: "qrc:/icon_back"
}
Rectangle{
id: overlay
z: 1
visible: !container.enabled
anchors.centerIn: parent
width: 30
height: width
color: "#99ffffff"
}
MouseArea{ Image{
id: controlObject id: image
anchors.fill: parent anchors.centerIn: parent
onClicked:{ width: 30
container.clicked(); height: width
source: "qrc:/icon_back"
} }
Rectangle{
id: overlay
z: 1
visible: !container.enabled
anchors.centerIn: parent
width: 30
height: width
color: "#99ffffff"
}
} }
} }

View file

@ -8,5 +8,6 @@
<file alias="icon_next">resources/next.jpg</file> <file alias="icon_next">resources/next.jpg</file>
<file alias="icon_previous">resources/previous.jpg</file> <file alias="icon_previous">resources/previous.jpg</file>
<file alias="icon_stop">resources/stop.jpg</file> <file alias="icon_stop">resources/stop.jpg</file>
<file alias="icon_close">resources/close.png</file>
</qresource> </qresource>
</RCC> </RCC>

View file

@ -8,6 +8,8 @@ Window {
height: 480 height: 480
title: "LenaPi 1.2" title: "LenaPi 1.2"
Component.onCompleted: showMaximized();
Image{ Image{
id: background id: background

BIN
LenaPi/resources/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB