[Android-development] Forcing native menubar to show
maitai at virtual-winds.org
maitai at virtual-winds.org
Sun Oct 5 07:44:21 CEST 2014
Finally found this:
https://bugreports.qt-project.org/browse/QTBUG-32002
And by tagetting api level 10 AND making sure that qt-5.3.2 is used by
ministro I get a working menu button on a device without physical keys.
Now the question is what do I loose by setting the target api to 10
instead of for instance 19?
Cheers,
Philippe.
Le 04-10-2014 17:05, maitai at virtual-winds.org a écrit :
> Hello,
> I am trying on a rather old tablet running Android 4.0.4 (api level
> 15).
> This device does not have physical keys at all, all is managed from the
> android system status bar which shows 3 or 4 icons depending on the
> case. The fourth icon is the option menu (the 3 vertical dots), and is
> missing when my qt application is running, although I do have a menubar
> in my QMainwindow. I discovered that if I specify uses-sdk
> android:targetSdkVersion="10" then the icon is here, but nothing
> happens
> when I press it, so it's rather useless. I also tried a variety of
> themes with no luck.
>
> After some more digging, I found out that one could do something like
> that:
> ...
> boolean hasMenu =
> ViewConfiguration.get(this).hasPermanentMenuKey();
> if(!hasMenu){
> //getWindow().setFlags(0x08000000, 0x08000000);
> try {
> getWindow().addFlags(WindowManager.LayoutParams.class.getField("FLAG_NEEDS_MENU_KEY").getInt(null));
> }
> ...
>
> but I don't know how to call something like that from qt application...
>
> So I am still at lost on that one :)
>
> Thanks for any hints,
> Philippe
>
>
>
> Le 03-10-2014 10:30, maitai at virtual-winds.org a écrit :
>> 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
> _______________________________________________
> 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