@JonB OK, for future readers here's the code I ended up with. It's a lot simpler than all the hallucinations provided by Google. I'm pretty sure it's not the canonical way to do this but it works and I'll continue studying the links provided in this thread.
import sys
from PySide6.QtCore import QFile
from PySide6.QtWidgets import QApplication, QVBoxLayout, QWidget
from PySide6.QtUiTools import QUiLoader
def load_ui(ui_file_path: str) -> QWidget:
loader = QUiLoader()
ui_file = QFile(ui_file_path)
if not ui_file.open(QFile.ReadOnly):
print("Cannot open ui file")
sys.exit(-1)
ui = loader.load(ui_file)
ui_file.close()
return ui
class MainWindow(QWidget):
def __init__(self, ui:QWidget):
super().__init__()
self.ui = ui
self.setWindowTitle("My Qt Designer App")
layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(ui)
# Load comboBox items
#ui.comboBox.addItems(getLoginCandidates(dbEngine))
ui.pushButton.clicked.connect(self.on_submit_clicked)
def on_submit_clicked(self):
print("The button was clicked!")
if __name__ == "__main__":
app = QApplication(sys.argv)
ui = load_ui("../ui/test.ui")
window = MainWindow(ui)
window.show()
rc = app.exec()
sys.exit(rc)