qml截图

    CQLPushButton {
        id: button5
        x: 4
        y: 201
        width: 190
        height: 90
        m_text: qsTr("导出jpg")
        onClickedSignal: {
            fds.open();
        }
    }

    FileDialog {
        id:fds
        title: "选择保存文件路径"
        folder: shortcuts.desktop
        selectExisting: true
        selectFolder: true
        selectMultiple: false
        onAccepted: {
            rectangle.grabToImage(function(result) {
                var path = fds.fileUrl + "/aa.jpg";
                var path1 = path.substring(8,path.length);
                console.log(path1);
                result.saveToFile( path1);
            });
        }
    }

猜你喜欢

转载自blog.csdn.net/cqltbe131421/article/details/84620934
QML