08-21-2012 01:57 AM - edited 08-21-2012 02:00 AM
I've set Menu programatically in my application. Application Menu works fine in portrait mode when i swipe down from top of the device. When I set orientation mode to landscape there's no response on swipe down from top.
Here's what I've coded in app.cpp file
QmlDocument *qml = QmlDocument::create("main.qml");
AbstractPane *root = qml->createRootNode<AbstractPane>();
Menu *menu;
QObject *aItem1 = root->findChild<QObject*>("aItem1"); // have created action items in main.qml
ActionItem* mActionItem1;
mActionItem1 = qobject_cast<ActionItem *>(aItem1);
QObject *aItem2 = root->findChild<QObject*>("aItem2");
ActionItem* mActionItem2;
mActionItem2 = qobject_cast<ActionItem *>(aItem2);
QObject *aItem3 = root->findChild<QObject*>("aItem3");
ActionItem* mActionItem3;
mActionItem3 = qobject_cast<ActionItem *>(aItem3);
QObject *aItem4 = root->findChild<QObject*>("aItem4");
ActionItem* mActionItem4;
mActionItem4 = qobject_cast<ActionItem *>(aItem4);
QObject *aItem5 = root->findChild<QObject*>("aItem5");
ActionItem* mActionItem5;
mActionItem5 = qobject_cast<ActionItem *>(aItem5);
menu =
Menu::create().addAction(mActionItem1).addAction(m
mActionItem3).addAction(mActionItem4).addAction(
mActionItem5);
bb::cascades::Application::setMenu(menu);
Application::setScene(root);
inside main.qml
import bb.cascades 1.0
NavigationPane {
id: navigationPane
Page {
content: Container {
background: Color.White
Label {
text: ""
}
}
actions: [
ActionItem {
id: aItem1
objectName: "aItem1"
imageSource: "asset:///images/user_guide.png"
// ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
navigationPane.deprecatedPushQmlByString("userguid
}
},..................
08-21-2012 01:40 PM
Thank you for finding and clearly describing this issue.
Please vote for https://www.blackberry.com/jira/browse/BBTEN-192
Stuart
08-22-2012 02:35 AM
Hi smacmartin,
Do we need to make custom application menu or in future update of BB10 we have resolve this issue?
08-24-2012 12:39 PM
The menu is there: I've seen it on some of the swipes in landscape. It seems to be the swipe that is the issue. You should not have to adjust the menu if you turn sideways -- the menu is attached to your application, not to the page, so if you adjust the UI for the current orientation that shouldn't affect the menu.
Stuart
09-18-2012 02:10 PM
Thanks a lot for your example. I was going crazy because I were unable to connect a signal using the example from the official documentation. With your code it works just great.
A small improvement. In my opinion it is more elegant to use directly ActionItem Objects:
In your .h:
ActionItem *mActionItem;
In your .cpp code:
Menu *menu = Menu::create();
mActionItem = root->findChild<ActionItem*>("ActionItemTest");
menu->addAction(mActionItem);
// accessable:
mActionItem->setTitle("Settings");
Application::setMenu(menu);
Application::setScene(root);
And I have used a TabbedPane in my code and were unable to add a ActionItem to it. So I added it like this:
attachedObjects: [
ActionItem {
id: aActionItem
objectName: "ActionItemTest"
imageSource: "test.png"
onTriggered: {
logic.ButtonPressed()
}
}
] Just in case somebody is facing the same problem. ![]()
01-22-2013 06:37 AM
Hi All,
I have a doubt ,can we change the background color of action item.If it so how can we change?
plzz help needed urgently.
Thanks
01-22-2013 10:43 AM
According to docs there is no property that would allow you to change background color of ActionItem
01-23-2013 12:27 AM
Hi,
Yes according to the docs there is no property,but is there is any other way to change the default background color.
Thanks