Skip to content
Snippets Groups Projects
DapButtonForm.ui.qml 3.48 KiB
Newer Older
konstantin.kukharenko's avatar
konstantin.kukharenko committed
import QtQuick 2.0
import QtQuick.Controls 2.0

Button {
    ///@detalis heightButton Button height.
    property int heightButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis widthButton Button width.
    property int widthButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis normalImageButton The picture on the Button is in normal state.
    property string normalImageButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis hoverImageButton The image on the Button is in the mouseover state.
    property string hoverImageButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis widthImageButton Image width.
    property int widthImageButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis heightImageButton Image height.
    property int heightImageButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis indentImageLeftButton: Indentation of the image from the left edge.
    property int indentImageLeftButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis colorBackgroundNormal Button background color in normal state.
    property string colorBackgroundNormal
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis colorBackgroundHover Button background color in hover state.
    property string colorBackgroundHover
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis textButton Text button.
    property string textButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis colorButtonTextNormal Button text color in normal state.
    property string colorButtonTextNormal
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis colorButtonTextHover Button text color in hover state.
    property string colorButtonTextHover
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis indentTextRight: Indentation of the text from the right edge.
    property int indentTextRight
    ///@detalis fontButton Font setting.
    property alias fontButton:buttonText.font
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis existenceImage Indicates the presence of an image.
    property bool existenceImage: true
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis horizontalAligmentText Horizontal alignment.
    property alias horizontalAligmentText:buttonText.horizontalAlignment
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis colorBackgroundButton This property overrides the background color.
    property alias colorBackgroundButton: dapBackgroundButton.color
    ///@detalis colorTextButton This property overrides the color of the text.
    property alias colorTextButton: buttonText.color
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis borderColorButton Sets the color of the border.
    property string borderColorButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
    ///@detalis borderWidthButton Sets the width of the border.
    property int borderWidthButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed

    id: dapButton

    contentItem: 
        Rectangle 
        {
            id: dapBackgroundButton
konstantin.kukharenko's avatar
konstantin.kukharenko committed
            anchors.fill: parent
            color: dapButton.hovered ? colorBackgroundHover : colorBackgroundNormal
            implicitWidth: widthButton
            implicitHeight: heightButton
            border.color: borderColorButton
            border.width: borderWidthButton
            ///button text
                id: buttonText
                anchors.fill: parent
                verticalAlignment: Qt.AlignVCenter
                horizontalAlignment: Qt.AlignRight
                anchors.rightMargin: indentTextRight
                color: dapButton.hovered ? colorButtonTextHover : colorButtonTextNormal
                text: qsTr(textButton)
            }
            ///button picture
            Image
            {
                id: iconNewWallet
                anchors.verticalCenter: if(existenceImage)parent.verticalCenter
                anchors.left: if(existenceImage)parent.left
                anchors.leftMargin:if(existenceImage) indentImageLeftButton
                source: if(existenceImage) dapButton.hovered ? hoverImageButton : normalImageButton
                width: if(existenceImage)widthImageButton
                height:if(existenceImage) heightImageButton
            }