Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 849
Registered: ‎03-03-2011
My Device: Z10

Re: How to create a settings Menu using Cascades...

It's also my mistake. I usually need more time to make real sample code if I haven't used specific API before. I was more pointing out.

Personally when I saw Application::setMenu(menu); it became clear to me that Menu can't be added in QML file - it is not a subpart of Page. It has to be done in C++. Additionaly there is only one Q_INVOKABLE method so even if you put menu into property context, no valuable method can be invoked.

I don't see any way to use Menu in a classic QML way like other UI components.
--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development
Developer
Posts: 305
Registered: ‎02-14-2012
My Device: BlackBerry Passport / Nokia N950
My Carrier: -

Re: How to create a settings Menu using Cascades...

[ Edited ]

soaman wrote:

I don't see any way to use Menu in a classic QML way like other UI components.

In my opinion it should work like at MeeGo-Harmattan by accessing a property of the root element. In fact I searched exactly for something like this. At example like at enabling the Status Bar (the area where the battery info is drawn) in the PageStackWindow Element which is only possible to place as a root element. But nothing compareable seems to exists at BB10.

So lets see how they want so integrate it "in a later release". Smiley Wink

Developer
Posts: 305
Registered: ‎02-14-2012
My Device: BlackBerry Passport / Nokia N950
My Carrier: -

Re: How to create a settings Menu using Cascades...


soaman wrote:
In C++:

Menu *menu = Menu::create()
.add(ActionItem::create().title("Menu Item 1"))
.add(ActionItem::create().title("Menu Item 2"))
.help(HelpActionItem::create());
Application::setMenu(menu);

 

Just a small update. I finally was tired waiting for the next Beta Release and needed the settings menu to make some progress at my project. So I tried to implement it like in the example via C++. Sadly I were unable to connect the Signal correctly to a Slot in my Code.

 

I found this solution and modified it a little bit. Just in case someone is interested: Link

 

It is now somewhat out of both worlds. I create and design my ActionItems in the qml file and assign those to the correct places via the C++ code. Still not the best solution, but there are already a lot of UI stuff at Cascades only via C++ code possible... so what...

 

Happy Hacking! Smiley Happy