Create Qt components with all parameters specified otherwise it will be instantiated with default properties

This commit is contained in:
Cameron Gutman 2018-08-16 23:29:46 -07:00
parent c1b1719914
commit 30f673efe1
4 changed files with 11 additions and 16 deletions

View File

@ -16,6 +16,8 @@
NvHTTP::NvHTTP(QString address) : NvHTTP::NvHTTP(QString address) :
m_Address(address) m_Address(address)
{ {
Q_ASSERT(!address.isEmpty());
m_BaseUrlHttp.setScheme("http"); m_BaseUrlHttp.setScheme("http");
m_BaseUrlHttps.setScheme("https"); m_BaseUrlHttps.setScheme("https");
m_BaseUrlHttp.setHost(address); m_BaseUrlHttp.setHost(address);

View File

@ -100,9 +100,7 @@ GridView {
} }
var component = Qt.createComponent("StreamSegue.qml") var component = Qt.createComponent("StreamSegue.qml")
var segue = component.createObject(stackView) var segue = component.createObject(stackView, {"appName": model.name, "session": appModel.createSessionForApp(index)})
segue.appName = model.name
segue.session = appModel.createSessionForApp(index)
stackView.push(segue) stackView.push(segue)
} }
@ -115,20 +113,19 @@ GridView {
standardButtons: StandardButton.Yes | StandardButton.No standardButtons: StandardButton.Yes | StandardButton.No
onYes: { onYes: {
var component = Qt.createComponent("QuitSegue.qml") var component = Qt.createComponent("QuitSegue.qml")
var segue = component.createObject(stackView) var params = {"appName": appName}
segue.appName = appName
if (segueToStream) { if (segueToStream) {
// Store the session and app name if we're going to stream after // Store the session and app name if we're going to stream after
// successfully quitting the old app. // successfully quitting the old app.
segue.nextAppName = model.name params.nextAppName = model.name
segue.nextSession = appModel.createSessionForApp(index) params.nextSession = appModel.createSessionForApp(index)
} }
else { else {
segue.nextAppName = null params.nextAppName = null
segue.nextSession = null params.nextSession = null
} }
stackView.push(segue) stackView.push(component.createObject(stackView, params))
// Trigger the quit after pushing the quit segue on screen // Trigger the quit after pushing the quit segue on screen
appModel.quitRunningApp() appModel.quitRunningApp()

View File

@ -154,9 +154,7 @@ GridView {
if (model.paired) { if (model.paired) {
// go to game view // go to game view
var component = Qt.createComponent("AppView.qml") var component = Qt.createComponent("AppView.qml")
var appView = component.createObject(stackView) var appView = component.createObject(stackView, {"computerIndex": index, "objectName": model.name})
appView.computerIndex = index
appView.objectName = model.name
stackView.push(appView) stackView.push(appView)
} }
else { else {

View File

@ -33,9 +33,7 @@ Item {
// If we're supposed to launch another game after this, do so now // If we're supposed to launch another game after this, do so now
if (error === undefined && nextSession !== null) { if (error === undefined && nextSession !== null) {
var component = Qt.createComponent("StreamSegue.qml") var component = Qt.createComponent("StreamSegue.qml")
var segue = component.createObject(stackView) var segue = component.createObject(stackView, {"appName": nextAppName, "session": nextSession})
segue.appName = nextAppName
segue.session = nextSession
stackView.push(segue) stackView.push(segue)
} }
} }