문제

I encountered a very strange problem:

if( currentWidgetType_m == WidgetTypesMap ) {
      qDebug() << "Here we are!";
      optionsMenu_mp->addAction( tr( "Change visibility" ),
         this, SLOT( VisibleItemClicked() ) );

      optionsMenu_mp->addSeparator();
}

optionsMenu_mp->addAction( tr( "Change statistics" ),
      this, SLOT( StatisticsItemClicked() ) );
optionsMenu_mp->addAction( tr( "Change view" ),
      this, SLOT( ViewItemClicked() ) );

The condition is true in this case and the debug message shows in the output, but the "Change visibility" action does not appear in the menu.

Any ideas what might be causing this?

Best regards

도움이 되었습니까?

해결책

The problem was caused by the QMenu not updating. I solved the problem by recreating the QAction that held the QMenu.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top