QML之自定义ButtonButton.qml ----------------------------- import QtQuick 1.0 Item { id: main width: 600 height: 300 Button { x: 80 y: 100 normalImage: "images/pause.png" pressedImage: "images/pause2.png" anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter onClicked: retryClicked(); } function retryClicked() { console.log("<div class="nav-previous"><a href="https://code84.com/25433.html" rel="prev"><span class="ast-left-arrow">←</span>linux正确的让jar后台启动的脚本,linux jar包后台运行脚本</a></div>D"); } } main.qml ------------------------------------- import QtQuick 1.0 Item { id: main width: 600 height: 300 Button { x: 80 y: 100 normalImage: "images/pause.png" pressedImage: "images/pause2.png" onClicked: retryClicked(); } function retryClicked() { console.log("<div class="nav-previous"><a href="https://code84.com/25433.html" rel="prev"><span class="ast-left-arrow">←</span>linux正确的让jar后台启动的脚本,linux jar包后台运行脚本</a></div>D"); } } 定义的Button有两种状态:按下和普通.版权声明:本文为liuhongwei123888原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。原文链接:https://blog.csdn.net/liuhongwei123888/article/details/6553814