[Qt-interest] How to hide softkey menu on Symbian?
Constantin Makshin
cmakshin at gmail.com
Fri Dec 3 13:56:31 CET 2010
This may be a bit off-topic, but IMHO it's not a very good idea to
programmatically close UI elements the user is currently working with.
Obviously, if the user opened a menu, [s]he did that to perform some
action. And while the user is going to click a menu item, the menu
suddenly closes. I guess that won't lead to anything except annoyance.
As for the subject, you may try to get the menu associated with the
softkey action by calling QAction::menu() and then close it with the
QMenu::close() function.
On Fri, Dec 3, 2010 at 3:00 PM, Tomasz Baniak <thomas.baniak at gmail.com> wrote:
> Hi Alessandro
> Proposed solution is not the case. I want this app to work exactly how it
> works now.
> So i am happy to have a menu under the softkey that will pop up when
> clicked.
> I just want it (popup, NOT softkey) to hide it programatically without
> having to delete it.
> Scenario:
> 1) User opens app -> app with SK is opened
> 2) User clicks SK -> menu pops up
> 3) While menu is visible 'something' happens so i would like my app to
> close/hide preciously shown menu
> Tomek
> 2010/12/3 <alessandro.portale at nokia.com>
>>
>> Hi,
>>
>> as a workaround, I believe you can set the action as a context action of
>> your main widget/dialog/window . The action should appear as softkey and not
>> open any submenu
>> http://doc.qt.nokia.com/4.7/qwidget.html#softkeys
>>
>> Hope that helps,
>> Alessandro
>> ________________________________________
>> From: qt-interest-bounces at trolltech.com
>> [qt-interest-bounces at trolltech.com] On Behalf Of ext Tomasz Baniak
>> [thomas.baniak at gmail.com]
>> Sent: Friday, December 03, 2010 11:06
>> To: qt-interest at trolltech.com
>> Subject: [Qt-interest] How to hide softkey menu on Symbian?
>>
>> Hi!
>>
>> I would like to hide a softkey menu (NOT a softkey, but a menu that is
>> possibly shown) on Symbian (to avoid bug
>> http://bugreports.qt.nokia.com/browse/QTBUG-14589).
>>
>> I did not succeed to do it in my app. I checked it on simple app with left
>> softkey menu constructed as this:
>> QMenu* m_menu;
>> ...
>> m_menu = new QMenu(this);
>> m_menu->addAction("Option 1", this, SLOT(menuItemTriggered()));
>> m_menu->addAction("Option 2", this, SLOT(menuItemTriggered()));
>> m_menu->addAction("Option 3", this, SLOT(menuItemTriggered()));
>> QAction *myMenuKey = new QAction("MyMenu", this);
>> myMenuKey->setSoftKeyRole(QAction::PositiveSoftKey);
>> myMenuKey->setMenu(m_menu);
>> menuBar()->addAction(myMenuKey);
>> and could not hide it in any way.
>>
>> I have tried:
>> m_menu->close();
>> m_menu->hide();
>> m_menu->setVisible(false);
>> without any success
>>
>> It seems that Symbian uses it's native menu and it has not much to do with
>> QMenu i used in a code above as it is possible to open MyMenu by clicking
>> action key and display it and in the same moment display second
>> 'instance'(?!) of the same menu by calling popup() (2 menus with the same
>> options visible).
>> On Windows the above situation works as expected (only 1 menu visible at
>> time).
>> Also calling (on Windows) hide/close does the trick to actually hide it.
>>
>> I will fill the bug later for 'double menu issue' later. But back to my
>> question:
>> How could i hide this left softkey menu on Symbian?
>>
>> Tomek
More information about the Qt-interest-old
mailing list