Skip to content

Instantly share code, notes, and snippets.

@alex-eri
Created February 26, 2020 18:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alex-eri/cdf0a529d6745eef6b49cb20e684bd37 to your computer and use it in GitHub Desktop.
Save alex-eri/cdf0a529d6745eef6b49cb20e684bd37 to your computer and use it in GitHub Desktop.
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