Skip to content

Instantly share code, notes, and snippets.

@fiskurgit
Last active Jan 7, 2020
Embed
What would you like to do?
Using Qt in Python via QML (instead of inline code) with the Material Design style
import sys
from PySide2.QtQml import QQmlApplicationEngine
from PySide2.QtWidgets import QApplication
from PySide2.QtCore import Qt, QCoreApplication
if __name__ == "__main__":
sys_argv = sys.argv
sys_argv += ['--style', 'Material']
app = QApplication(sys_argv)
engine = QQmlApplicationEngine('view.qml')
sys.exit(app.exec_())
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
ApplicationWindow {
visible: true
Material.theme: Material.Dark
Material.accent: Material.Purple
title: "Qt Hello Material"
width: 640
height: 480
Column {
anchors.centerIn: parent
RadioButton { text: qsTr("Smol") }
RadioButton { text: qsTr("Medium"); checked: true }
RadioButton { text: qsTr("Large") }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment