The old QML was a giant mess of implementation details and logic. Reducing the buttons to only 2 essential properties allows the MediaControllerKeys object to be more easily understood. Moving the MediaControllerKeys into its own QML file allows the resulting page to be more easily understood and individual pieces swapped in and out. The current QML directory structure is non-existent, breaking parts down into cohesive folders will allow for easier understanding of the bigger picture.
39 lines
947 B
QML
39 lines
947 B
QML
import QtQuick 2.7
|
|
import QtQuick.Controls 2.0
|
|
import QtQuick.Layouts 1.3
|
|
import matzman666.advsettings 1.0
|
|
// Necessary for the project specific Components.
|
|
import ".."
|
|
|
|
MyPushButton2 {
|
|
// Public properties
|
|
id: mediaButton
|
|
onClicked: {
|
|
// Overload this
|
|
}
|
|
property string imagePath: ""
|
|
|
|
// Private properties
|
|
Layout.preferredHeight: 48
|
|
Layout.preferredWidth: 48
|
|
contentItem: Image {
|
|
source: parent.imagePath
|
|
sourceSize: Qt.size( imgSP.sourceSize.width*2, imgSP.sourceSize.height*2 )
|
|
Image{
|
|
id: imgSP
|
|
source: parent.source
|
|
width:0
|
|
height:0
|
|
}
|
|
anchors.fill: parent
|
|
}
|
|
|
|
background: Rectangle {
|
|
// Provides feedback for mousing over and clicking buttons.
|
|
opacity: parent.down ? 1.0 : (parent.activeFocus ? 0.5 : 0.0)
|
|
color: "#406288"
|
|
radius: 4
|
|
anchors.fill: parent
|
|
}
|
|
}
|