import QtQuick 2.0

Rectangle {
    id: btn;
        width: 50;
        height: 20;
        radius: 2;
        border.color: "#A3A3A3";
        border.width: 1;
        property alias text:btnTxt.text;
        Text {
            id: btnTxt;
            anchors.centerIn: parent;
            text: qsTr("text")
        }
        Gradient{
                id: grad;
                    GradientStop{ position: 0.0; color: "#FDFDFD";}
                    GradientStop{ position: 0.5; color: "#EFEFEF"; }
                    GradientStop{ position: 1.0; color: "#E3E3E3";}
                }
        gradient: grad;
        MouseArea{
            anchors.fill: parent;
            onPressed: {
                console.log("clicked")
                btn.color = "#D1D1D1"
                btn.gradient = undefined;
            }
            onReleased:{
                console.log("release")
                btn.color = "tansparent";
                btn.gradient  = grad;
            }
        }
}

 

相关文章:

  • 2022-02-25
  • 2022-12-23
  • 2021-11-14
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
猜你喜欢
  • 2021-09-03
  • 2022-12-23
  • 2021-08-07
  • 2022-12-23
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案