mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 22:58:15 +00:00
48 lines
1,012 B
QML
48 lines
1,012 B
QML
import QtQuick 2.7
|
|
import QtQuick.Controls 2.0
|
|
|
|
import Common 1.0
|
|
|
|
// ===================================================================
|
|
// An animated (or not) button with image(s).
|
|
// ===================================================================
|
|
|
|
Button {
|
|
id: button
|
|
|
|
property bool useStates: true
|
|
property int iconSize
|
|
|
|
// If `useStates` = true, the used icons are:
|
|
// `icon`_pressed, `icon`_hovered and `icon`_normal.
|
|
property string icon
|
|
|
|
function _getIcon () {
|
|
if (!useStates) {
|
|
return button.icon
|
|
}
|
|
|
|
return button.icon + (
|
|
button.down
|
|
? '_pressed'
|
|
: (button.hovered ? '_hovered' : '_normal')
|
|
)
|
|
}
|
|
|
|
background: Rectangle {
|
|
color: 'transparent'
|
|
}
|
|
hoverEnabled: true
|
|
|
|
// Ugly hack, use current size, ActionBar size,
|
|
// or other parent height.
|
|
height: iconSize || parent.iconSize || parent.height
|
|
width: iconSize || parent.iconSize || parent.height
|
|
|
|
Icon {
|
|
id: icon
|
|
|
|
anchors.fill: parent
|
|
icon: _getIcon()
|
|
}
|
|
}
|