02-21-2013 08:19 AM - edited 02-21-2013 08:23 AM
All GUI controls inherit from BaseObject which has parent property. A possible solution is to find NavigationPane by iterating CustomControl's parents. This way it will work even when the control is deep in hierarchy of objects.
Untested code:
NavigationPane *MyControl::navigationPane()
{
QObject *p = parent();
while (p)
{
NavigationPane *pane = qobject_cast<NavigationPane *>(p);
if (pane != NULL)
return pane;
p = p->parent();
}
return NULL;
}
...
NavigationPane *pane = navigationPane();
if (pane)
pane->setPeekEnabled(false);
upd: actually QObject has parent property, BaseObject just exposes it to QML. So it's ok to use QObject in code above.
02-21-2013 09:03 AM
02-21-2013 06:17 PM - edited 02-21-2013 06:25 PM
Thanks guys appreciate the responses,
I think I'll give these a shot and see if any are suitable to my app.
Having tested this before Zmeys idea necessitates setting parent throughout the whole hierarchy and for my code at least with deeply hierarchical structures I often find parent is null at some point in the chain and therefore not guaranteed to work. At least in my code that is.
Still a bug though. ![]()