[Android-development] Forcing native menubar to show

maitai at virtual-winds.org maitai at virtual-winds.org
Fri Oct 3 10:30:55 CEST 2014


Hi again,

I do have a QMainWindow with setMenuBar(menubar). On my device (Samsung 
Galaxy S4/Android 4.4.2), the menuBar is not displayed on the screen but 
available through the physical left button. On the user's device 
(Samsung Galaxy S5/Android 4.4.2) the menu does not appear anywhere too, 
but since they have replaced the left button with a "task" button he is 
obliged to press-long this physical key to get the menus, a rather 
obscure way that most users won't know about:

http://www.androidcentral.com/samsung-galaxy-s5-menu-button-hidden

Do you mean the menu should be appearing like on a desktop?

Thanks
Philippe.

Le 03-10-2014 08:40, BogDan a écrit :
> Hi,
> 
>   If you are using a QMainWindow which have menus, then the menu bar
> will be displayed automatically.
> 
> 
> Cheers,
> BogDan.
> 
> 
> ----- Original Message -----
> From: "maitai at virtual-winds.org" <maitai at virtual-winds.org>
> To: Android Development <Android-development at qt-project.org>
> Cc:
> Sent: Thursday, October 2, 2014 5:09 PM
> Subject: Re: [Android-development] Forcing native menubar to show
> 
> Hello again.
> 
> Concerning this issue (being able to call the native menu from the
> application), is there anything I can try?
> 
> The thing is that some users are on a samsumg galaxy s5, for which they
> just removed the menu key so the application must provide a menu-button
> somewhere (well the user can press-long the new "Task" button instead
> but nobody knows it). Some other devices also do not have a physical
> menu button (nexus for instance). I found various posts on internet
> concerning this, for instance:
> 
> http://stackoverflow.com/questions/15250024/show-options-menu-button-on-galaxy-nexus-android-4-1
> 
> What would be the best way to deal with that kind of devices? I do need
> a menu somewhere :)
> 
> Thanks,
> Philippe Lelong
> 
> Le 20-08-2014 18:27, maitai at virtual-winds.org a écrit :
>> Hello,
>> 
>> Any hope this is going to be pushed in 5.4? I'm still trying to find a
>> way to trigger android native menu programatically...
>> 
>> Thanks
>> Philippe LELONG
>> 
>> Le 04-04-2014 07:29, BogDan a écrit :
>>> Hi,
>>> 
>>>   There are two pending
>>> patches https://codereview.qt-project.org/#change,72098
>>> and https://codereview.qt-project.org/#change,72099 that does
>>> everithing you want, sadly except me, nobody wanted to approve 
>>> them...
>>> 
>>> 
>>> Cheers,
>>> BogDan.
>>> 
>>> 
>>>> 
>>>> Coming back on this:
>>>> 
>>>> I have investigated using QtAndroid (5.3.0-beta1) to achieve that 
>>>> and
>>>> I
>>>> guess this is the way to go.
>>>> 
>>>> I have tried various things involving QAndroidJniObject,
>>>> QAndroidJniEnvironment and QtAndroid::androidActivity(), but didn't
>>>> succeed to get what I want.
>>>> 
>>>> For instance:
>>>> 
>>>>      QAndroidJniObject activity=QtAndroid::androidActivity();
>>>>      bool
>>>> b=QAndroidJniObject::isClassAvailable("android/app/Activity");
>>>>      qWarning()<<"class available?"<<b;
>>>>      //QAndroidJniObject activity("android/app/Activity");
>>>>      if(activity.isValid())
>>>>      {
>>>>          qWarning()<<"activity is valid";
>>>> 
>>>> activity.callMethod<void>("openOptionsMenu","()V");
>>>>      }
>>>> 
>>>> I guess my approach is too simplistic but I couldn't google any good
>>>> example to do this..
>>>> 
>>>> Any help or hint would be really appreciated
>>>> 
>>>> Thanks
>>>> Philippe LELONG
>>>> 
>>>> Le 01-04-2014 15:27, maitai at virtual-winds.org a écrit :
>>>>>  Hello,
>>>>> 
>>>>>  I have a QMenubar which became "native" on android, all is good.
>>>> I
>>>>>  would
>>>>>  like to know if it's possible somehow to trigger it
>>>>> programatically?
>>>>> 
>>>>>  I have tried various menuBar->show() or submenu->exec()...
>>>>> apparently
>>>> 
>>>>>  no
>>>>>  way.
>>>>> 
>>>>>  The reason I am trying to do that is that I want to show a
>>>> "native"
>>>>>  contextual menu on tap-and-hold, the current QMenu that I can 
>>>>> popup
>>>>>  does
>>>>>  not look "android" enough to me...
>>>>> 
>>>>>  Thanks
>>>>>  Philippe LELONG
>>>>>  _______________________________________________
>>>>>  Android-development mailing list
>>>>>  Android-development at qt-project.org
>>>>>  http://lists.qt-project.org/mailman/listinfo/android-development
>>>> 
>>>> _______________________________________________
>>>> Android-development mailing list
>>>> Android-development at qt-project.org
>>>> http://lists.qt-project.org/mailman/listinfo/android-development
>>>> 
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/android-development



More information about the Android-development mailing list