7 Star 3 Fork 1

wjzhe / mapEditor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
FlatButton.qml 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
maxy 提交于 2017-02-22 13:03 . 增加点击操作按钮显示帮助;
import QtQuick 2.2
import QtQuick.Controls 2.0
Rectangle {
id: bkgnd;
implicitWidth: 35;
implicitHeight: 30;
color: "transparent";
property alias iconSource: icon.source;
property alias iconWidth: icon.width;
property alias iconHeight: icon.height;
property alias textColor: btnText.color;
property alias font: btnText.font;
property alias text: btnText.text;
property alias toolTipText: toolTip.text;
radius: 4;
property bool hovered: false;
border.color: "lightsteelblue";
border.width: hovered ? 2 : 1;
signal clicked;
ToolTip {
id: toolTip;
visible: hovered;
delay: 500;
timeout: 2500;
}
Image {
id: icon;
anchors.left: parent.left;
anchors.verticalCenter: parent.verticalCenter;
}
Text {
id: btnText;
anchors.left: icon.right;
anchors.centerIn: parent;
anchors.verticalCenter: icon.verticalCenter;
anchors.margins: 4;
font.pointSize: 18;
color: ma.pressed ? "blue" : (parent.hovered ? "#0000a0" : "deeppink");
}
MouseArea {
id: ma;
anchors.fill: parent;
hoverEnabled: true;
onEntered: {
bkgnd.hovered = true;
}
onExited: {
bkgnd.hovered = false;
}
onClicked: {
bkgnd.hovered = false;
bkgnd.clicked();
}
}
}
C++
1
https://gitee.com/null_446_4477/mapeditor.git
git@gitee.com:null_446_4477/mapeditor.git
null_446_4477
mapeditor
mapEditor
master

搜索帮助