Skip to content

Instantly share code, notes, and snippets.

@alex-eri

alex-eri/main.py

Created Feb 26, 2020
Embed
What would you like to do?
from PySide2.QtWidgets import QApplication
from PySide2.QtCore import QUrl
import os
import sys
from PySide2.QtQml import QQmlApplicationEngine
# sys.argv += ['--style', 'material']
app = QApplication(sys.argv)
qml_file = os.path.join(os.path.dirname(__file__), "main.qml")
view =QQmlApplicationEngine(parent=app)
view.addImportPath(os.path.dirname(__file__))
view.load(QUrl.fromLocalFile(os.path.abspath(qml_file)))
sys.exit(app.exec_())
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1 as Platform
import QtQuick.Window 2.14
import Qt.labs.settings 1.1
import QtQuick.Controls.Material 2.14
import QtGraphicalEffects 1.14
import QtQuick.Dialogs 1.3 as Dialogs
ApplicationWindow {
flags: Qt.FramelessWindowHint
id: main
Dialogs.Dialog {
title: "Title"
id: dialog
visible: true
standardButtons: Dialog.Cancel | Dialog.Open
Label {
text: 'Text'
}
onAccepted: console.log("Ok clicked")
onRejected: console.log("Cancel clicked")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.