Uygulamamın tasarımını qt designer ile oluşturuyorum ve ardından pyuıc5 örneğini kullanarak her pencereyi bir python dosyasına dönüştürüyorum.kullanıcı arayüzü example.py bir Uı_Form sınıfı alabilir ve programımda çağırabilir. Yani her şey çalışıyor ama şimdi tasarımımızı değiştirdik ve bir qml dosyası aldık. Sorum, uygulamanın kavramlarını değiştirmeden bu qml dosyalarıyla nasıl çalışılacağıdır. Qml'yi dönüştürmek ve pyqt5'te kullanmak için pyuıc5 (Uı_Form sınıfını almak için) gibi bir yöntem var mı?
Bu eski uygulamanın bir örneğidir:
from main_screen import Ui_Form as Ui_main_screen
class MainScreen(QWidget, Ui_main_screen):
teachButton = False
manageButton = False
utilitiesButton = False
adminButton = False
helpButton = False
systemButton = False
inspectionButton = False
modelSelected = None
def __init__(self):
super(MainScreen, self).__init__()
#QWidget.__init__(self)
self.setupUi(self)
self.trans = QTranslator(self)
self.toLanguage()
self.product()
self.Menu() .....
Gördüğünüz gibi, uı_form'u MainScreen sınıfına içe aktardım. Şimdi aynı şeyi qml dosyasıyla yapmak istiyorum
import QtQuick 2.7
Item {
width:904
height:678
Image {
id: background
source: "images/background.png"
x: 0
y: 1
opacity: 1
}
Image {
id: logo
source: "images/logo.png"
x: 691
y: 34
opacity: 1
}
Image {
id: teach
source: "images/teach.png"
x: 717
y: 154
opacity: 1
}
Image {
id: administration
source: "images/administration.png"
x: 711
y: 410
opacity: 0.49803921568627
}
Image {
id: system
source: "images/system.png"
x: 708
y: 468
opacity: 0.49803921568627
}
Image {
id: utilities
source: "images/utilities.png"
x: 711
y: 353
opacity: 0.49803921568627
}
Image {
id: help
source: "images/help.png"
x: 712
y: 524
opacity: 0.49803921568627
}
Image {
id: teachinf_wizard
source: "images/teachinf_wizard.png"
x: 740
y: 196
opacity: 1
}
Image {
id: inspection
source: "images/inspection.png"
x: 713
y: 295
opacity: 0.49803921568627
}
Image {
id: manage
source: "images/manage.png"
x: 714
y: 239
opacity: 1
}
}
Peki qml dosyası ile Uı_Form sınıfı gibi bir şey nasıl elde edilir