Skip to content

Instantly share code, notes, and snippets.

@LinArcX
Created June 18, 2019 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LinArcX/3bbd4375ed98ebdb2cd5189b604a8f73 to your computer and use it in GitHub Desktop.
Save LinArcX/3bbd4375ed98ebdb2cd5189b604a8f73 to your computer and use it in GitHub Desktop.
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQuick.Controls.impl 2.4
import QtQuick.Templates 2.4 as T
T.Button {
id: control
property string iconFamily
property string iconName
property int iconSize
property int textSize
property string iconMargin
property string btnTxt
property string mTextMargin
property string mTextSize
property string qColor
property string qTextColor
leftPadding: padding + 2
rightPadding: padding + 2
implicitWidth: mContentItem.width + leftPadding + rightPadding
implicitHeight: mContentItem.height + topPadding + bottomPadding
Rectangle {
id: mParent
anchors.fill: parent
clip: true
color: control.enabled ? qColor : "#9E9E9E"
opacity: control.enabled ? 1 : 0.5
Rectangle {
id: mContentItem
anchors.centerIn: parent
width: mText.width + mIcon.width + 20
height: mText.height + 20
color: qColor
clip: true
Text {
id: mText
anchors.right: mIcon.left
anchors.rightMargin: 5
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: textSize ? textSize : 15
color: qTextColor ? qTextColor : "white"
text: btnTxt
clip: true
}
Text {
id: mIcon
font.family: iconFamily
text: iconName
anchors.right: parent.right
anchors.rightMargin: iconMargin ? iconMargin : 10
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: iconSize ? iconSize : 18
color: qTextColor ? qTextColor : "white"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment