We have moved to a new Sailfish OS Forum. Please start new discussions there.
1 | initial version | posted 2014-05-26 14:20:29 +0200 |
I will update this later with sscce, if i manage to reproduce this
I have two pages and one dialog in my application. First page uses pageStac.push to open 2nd page. Both pages uses the dialog, which is pushed also to pageStack from MenuItem - onClicked.
On the first page, in the dialog.connect function() if i do console.log(parent)
, i get a valid parent, same as from onClicked.
On the second page, in the dialog.connect function() if i do console.log(parent)
, i get "undefine", altough onClicked shows a valid parent.
Is this a bug somewhere?
As a workaround, in the 2nd page MenuItem-onClicked, i call function which is not in the MenuItem. If i push to dialog from this function, everything works fine.
2 | No.2 Revision |
I will update this later with sscce, if i manage to reproduce this
I have two pages and one dialog in my application. First page uses pageStac.push to open 2nd page. Both pages uses the dialog, which is pushed also to pageStack from MenuItem - onClicked.
On the first page, in the dialog.connect function() if i do console.log(parent)
, i get a valid parent, same as from onClicked.
On the second page, in the dialog.connect function() if i do console.log(parent)
, i get "undefine", altough onClicked shows a valid parent.
Is this a bug somewhere?
As a workaround, in the 2nd page MenuItem-onClicked, i call function which is not in inside the MenuItem. If i push to dialog from this function, everything works fine.
````
Page { .... ListView { .... delegate: ListItem { menu: contextMenu .... function doThatThing() { console.log(parent) // <<-- this prints a valid parent var editDialog = pageStack.push(Qt.resolvedUrl("thatDialog.qml"))
editDialog.accepted.connect( function()
{
console.log(parent) // <<-- this prints a valid parent
})
}
Row
{
....
}
Component
{
id: contextMenu
ContextMenu
{
MenuItem
{
text: "This works"
onClicked: doThatThing();
}
MenuItem
{
text: "This does not work on page 2, works on page 1"
onClicked:
{
console.log(parent) // <<-- this prints a valid parent
var editDialog = pageStack.push(Qt.resolvedUrl("thatDialog.qml"))
editDialog.accepted.connect( function()
{
console.log(parent) // <<-- this prints undefined on page 2
})
}
}
}
}
}
}
}
````
3 | No.3 Revision |
I have two pages and one dialog in my application. First page uses pageStac.push to open 2nd page. Both pages uses the dialog, which is pushed also to pageStack from MenuItem - onClicked.
On the first page, in the dialog.connect function() if i do console.log(parent)
, i get a valid parent, same as from onClicked.
On the second page, in the dialog.connect function() if i do console.log(parent)
, i get "undefine", altough onClicked shows a valid parent.
Is this a bug somewhere?
As a workaround, in the 2nd page MenuItem-onClicked, i call function which is not inside the MenuItem. If i push to dialog from this function, everything works fine.
````(askbot code render failed, so see here for Code snip )
Page
{
....
ListView
{
....
delegate: ListItem
{
menu: contextMenu
....
function doThatThing()
{
console.log(parent) // <<-- this prints a valid parent
var editDialog = pageStack.push(Qt.resolvedUrl("thatDialog.qml"))
editDialog.accepted.connect( function()
{
console.log(parent) // <<-- this prints a valid parent
})
}
Row
{
....
}
Component
{
id: contextMenu
ContextMenu
{
MenuItem
{
text: "This works"
onClicked: doThatThing();
}
MenuItem
{
text: "This does not work on The same code for page 2, works on page 1"
onClicked:
{
console.log(parent) // <<-- this prints a valid parent
var editDialog = pageStack.push(Qt.resolvedUrl("thatDialog.qml"))
editDialog.accepted.connect( function()
{
console.log(parent) // <<-- this prints undefined on page 2
})
}
}
}
}
}
}
}
````1 and 2.
4 | No.4 Revision |
I have two pages and one dialog in my application. First page uses pageStac.push to open 2nd page. Both pages uses the dialog, which is pushed also to pageStack from MenuItem - onClicked.
On the first page, in the dialog.connect function() if i do console.log(parent)
, i get a valid parent, same as from onClicked.
On the second page, in the dialog.connect function() if i do console.log(parent)
, i get "undefine", altough onClicked shows a valid parent.
Is this a bug somewhere?
As a workaround, in the 2nd page MenuItem-onClicked, i call function which is not inside the MenuItem. If i push to dialog from this function, everything works fine.
(askbot code render failed, so see here for Code snip )
The same code for page 1 and 2.
EDIT: add diagram; The green functions work, orange does not work.
5 | No.5 Revision |
I have two pages and one dialog in my application. First page uses pageStac.push to open 2nd page. Both pages uses the dialog, which is pushed also to pageStack from MenuItem - onClicked.
On the first page, in the dialog.connect function() if i do console.log(parent)
, i get a valid parent, same as from onClicked.
On the second page, in the dialog.connect function() if i do console.log(parent)
, i get "undefine", altough onClicked shows a valid parent.
Is this a bug somewhere?
As a workaround, in the 2nd page MenuItem-onClicked, i call function which is not inside the MenuItem. If i push to dialog from this function, everything works fine.
(askbot code render failed, so see here for Code snip )
The same code for page 1 and 2.
EDIT: add diagram; The green functions work, orange does not work.