社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Python

如何将qml文件从V-Play转换为python?

U10-Forward • 5 年前 • 1569 次点击  

我有一个qml文件,如下所示(由 V-Play

import VPlayApps 1.0
import QtQuick 2.0

App {
    // You get free licenseKeys from https://v-play.net/licenseKey
    // With a licenseKey you can:
    //  * Publish your games & apps for the app stores
    //  * Remove the V-Play Splash Screen or set a custom one (available with the Pro Licenses)
    //  * Add plugins to monetize, analyze & improve your apps (available with the Pro Licenses)
    //licenseKey: "<generate one from https://v-play.net/licenseKey>"

    NavigationStack {

        Page {
            title: qsTr("My page")

        }

        AppTextField {
            id: appTextField
            x: 0
            y: 329
            width: 256
            height: 19
            anchors.centerIn: parent
        }

        AppTextField {
            id: appTextField1
            x: 0
            y: 329
            width: 256
            height: 19
            anchors.verticalCenterOffset: 50
            anchors.centerIn: parent
        }

        Text {
            id: text1
            x: 0
            y: 620
            width: 24
            height: 20
            text: qsTr("A")
            font.pixelSize: 25
            anchors.horizontalCenter: appTextField1.horizontalCenter
        }

        AppButton {
            id: button
            x: 0
            y: 575
            width: 24
            height: 20
            text: qsTr("Click me please!")
            anchors.horizontalCenter: appTextField1.horizontalCenter
        }
    }
}

我用Qt设计器创建了许多PyQt5应用程序,因此它将是一个.ui文件,我可以通过 pyuic5 ,但这是我第一次使用V-Play Qt Creator。

如何将其转换为python文件(.py),如您在代码中看到的,我创建了两个输入区域( AppTextField ),我希望它成为一个python文件,这样我就可以添加在输入区域中对数字进行相加的函数,我尝试了一些东西,但都没有成功,我查看了这个, Developing Python applications in Qt Creator ,还有一些,但他们没有达到我的目标。

我该怎么做呢?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/54757
 
1569 次点击  
文章 [ 1 ]  |  最新文章 5 年前
Romha Korev
Reply   •   1 楼
Romha Korev    6 年前

qtl由Qt解释以生成图形项。我认为你不能把QML转换成Python。

但是,您可以很容易地将此文件集成到python脚本中: http://pyqt.sourceforge.net/Docs/PyQt5/qml.html

app = QGuiApplication(sys.argv)
engine = QQmlApplicationEngine()
engine.load(QUrl('./main.qml'))
app.exec_()