Som vytvoriť dizajn moja aplikácia s qt designer a potom premeniť každé okno na python súbor pomocou príkazu pyuic5 príklad.ui -o example.py v schopný získať Ui_Form triedy a nazývať to v mojom programe. Takže každý vec je práca, ale teraz sme zmenili náš návrh a dostaneme program files. Moja otázka je, ako pracovať s týmto požiadavky súbory bez zmeny koncepcie aplikácie. Existuje spôsob, ako pyuic5 (aby sa Ui_Form triedy) transformovať požiadavky a použiť ho v pyqt5.
Toto je príklad starého app:
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() .....
Ako môžete vidieť, I dovezených Ui_Form do MainScreen triedy. Teraz chcem urobiť to isté s program súboru
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
}
}
Tak, ako sa dostať niečo ako Ui_Form triedy s program súboru