【发布时间】:2010-12-19 22:44:58
【问题描述】:
我创建并在底部显示一个带有软键选项的 QWebView。当我单击“选项”时,会出现一个菜单,但它很小,呈黑色,位于左上角(它应该看起来像标准的蓝色软键并位于它们的正上方)。我关注了这个example。
//create webview
webView = new QWebView;
webView->setUrl(QString(":html/internal.html"));
//create menu
QAction *option1 = new QAction(tr("Back"), webView);
option1->setSoftKeyRole(QAction::PositiveSoftKey);
connect(option1, SIGNAL(triggered()), this, SLOT(deleteView()));
//create right softkey action to launch the "options" menu
QAction *option2 = new QAction(tr("Options"), webView);
option2->setSoftKeyRole(QAction::NegativeSoftKey);
connect(option2, SIGNAL(triggered(), this, SLOT(showMenu()));
QMenu *menuOptions = new QMenu(webView);
menuOptions->addAction(tr("Sub Menu 1"), this, SLOT(aboutView()));
menuOptions->addAction(tr("Sub Menu 2"), this, SLOT(aboutView()));
option2->setMenu(menuOptions);
//add softkey menus
QList < QAction* > softKeys;
softKeys.append(option1);
softKeys.append(option2);
webView->addActions(softKeys);
webView->show();
【问题讨论】:
-
" 如果您在模拟器中运行它,我建议您在真实硬件中试一试。模拟器在显示 Symbian 原生组件时可能会出现一些问题,例如“选项菜单”,所以我我要试一试。
标签: qt mobile qt4 symbian nokia