import QtQuick 2.0 import QtQuick.Controls 2.13 import QtGraphicalEffects 1.13 import "qrc:/theme" import "qrc:/const" Item { id: button property var image: "" property var radius: Math.min(width / 2, height / 2) property var colorMode: 0 // 0->None; 1->White; 2->Green; 3->Yellow property color backLightColor: getColorMode() implicitWidth: Const.microButton implicitHeight: Const.microButton function getColorMode() { switch(colorMode) { case(0): return Theme.current.none case(1): return Theme.current.white case(2): return Theme.current.green case(3): return Theme.current.yellow } } Item { id: content width: parent.implicitWidth height: parent.implicitWidth z: 1 Item { property var factor: 0.8 anchors.horizontalCenter: parent.horizontalCenter y: (parent.height * (1-factor)) / 2 width: parent.width * factor height: parent.height * factor Image { id: img anchors.fill: parent source: image fillMode: Image.PreserveAspectFit antialiasing: true smooth: true } ColorOverlay { anchors.fill: img source: img color: Theme.current.text antialiasing: true smooth: true } } } Rectangle{ id: background width: parent.implicitWidth height: parent.implicitHeight radius: button.radius color: Theme.current.button anchors.fill: parent } DropShadow { id: dropDown anchors.fill: background source: background horizontalOffset: 6 verticalOffset: 6 radius: 10 samples: 16 color: Theme.current.shadow } DropShadow { id: dropUp anchors.fill: background source: background horizontalOffset: -4 verticalOffset: -4 radius: 5 samples: 10 color: Theme.current.light } Glow { id: glow anchors.fill: background source: background radius: 10 samples: 20 color: backLightColor transparentBorder: true } }