You need to set the context property before you call View.setSource
, otherwise at the moment the qml file is read the property ggg
is indeed not defined.
Try this:
App = QGuiApplication(sys.argv)
View = QQuickView()
Context = View.rootContext()
GlobalConfig = Config('sc').getGlobalConfig()
print (GlobalConfig, type(GlobalConfig))
Context.setContextProperty('ggg', GlobalConfig)
View.setSource(QUrl('views/sc_side/Main.qml'))
View.setResizeMode(QQuickView.SizeRootObjectToView)
View.showFullScreen()
sys.exit(App.exec_())
Disclaimer: without knowing what Config
is, I can't say if it will really work without any other modification.