[Android-development] Native menubar and modal dialogs

maitai at virtual-winds.org maitai at virtual-winds.org
Wed Sep 3 10:56:58 CEST 2014


In fact I get a crash on accessing QMenuBar::actions() only if actions() 
is empty. This is I think nevertheless a bug in Qt but I can manage it 
from inside my subclass, so it's not really a problem.

Sorry for the false report.

Philippe Lelong

Le 03-09-2014 10:42, maitai at virtual-winds.org a écrit :
> Hello,
> 
> This is related to QTBUG-38777
> 
> I am trying to disable the menu each time a QDialog pops up but I am
> facing another problem if I do that:
> 
> void MenuBar::blockMenu(const bool &block)
> {
>      if(block){
>          qWarning()<<"disabling menu..."<<actions().size();
>          while(!actions().isEmpty()){
>                  qWarning()<<"removing"<<actions().first()->text();
>                  this->removeAction(actions().first());
>          }
>          qWarning()<<"disabling menu ok";
>      } else {
>          if(actions().isEmpty()){
>              qWarning()<<"enabling menu...";
>              for(int n=0; n<currentMenu.size(); ++n)
>                  this->addMenu(currentMenu.at(n));
>              qWarning()<<"enabling menu ok";
>          }
>      }
> }
> 
> 
> This is working fine when the action menu that triggered the dialog is
> at first or second level in the menu. If it's a third level menu, I get
> a crash on the qWarning()<<...<<actions().size();
> 
> It seems that actions() is out of scope and that I cannot even access 
> to
> QMenuBar::actions().size().
> 
> If I add a tempo of 1 second before calling this routine, then it works
> and I don't get a crash anymore, so it really seems that Qt is doing
> something tricky with the menubar that I should not disturb ;) But I
> cannot really put this bad tempo trick in production... I am not even
> sure 1 sec will be enough on all devices...
> 
> I have also tried to use QWidget::setAttribue(Qt::QA_disabled) and
> QA_ForceDisabled but this has no effect on the native menubar...
> 
> Any clue? Or maybe I just have to wait for 5.4 because QTBUG-38777 will
> be fixed?
> 
> Thanks
> Philippe Lelong
> 
> Le 05-05-2014 13:07, BogDan a écrit :
>> Hi,
>> 
>>   The android menu bar should reflect the active window, e.g. if the
>> active window has a QMenubar if should display it, if not it should be
>> empty/disabled.
>> Please use https://bugreports.qt-project.org to open an issue and
>> assigne it to me.
>> 
>> 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: Monday, May 5, 2014 10:05 AM
>> Subject: [Android-development] Native menubar and modal dialogs
>> 
>> Hello,
>> 
>> In my opinion, the native android menu (QMenubar) should be inactive
>> when a modal dialog is executing (like it is on other platforms). Is
>> there a way to achieve that without emptying/refiling it each time a
>> modal qdialog pops up?
>> 
>> 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



More information about the Android-development mailing list