Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [QT 5.9.7][Linux X11]Different behavior QMenu on Debug and Release build.
Forum Updated to NodeBB v4.3 + New Features

[QT 5.9.7][Linux X11]Different behavior QMenu on Debug and Release build.

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
2 Posts 2 Posters 378 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kas_ru
    wrote on last edited by
    #1

    I have simple code with QMenu class:

    QMenu* menu = new QMenu( mainWindow_ )
    menu->setSizePolicy( QSizePolicy::Preferred, menu->sizePolicy().verticalPolicy() );
    menu->setFixedWidth( QWIDGETSIZE_MAX );
    menu->clear();
    
    QAction* action;
    
    action = menu->addAction( tr( "Send report" ) );
    action->setObjectName( "sendReport" );
    
    action = menu->addAction( tr( "Show in folder" ) );
    action->setObjectName( "showInFolder" );
    menu->setSizePolicy( QSizePolicy::Fixed, menu->sizePolicy().verticalPolicy() );
    menu->setFixedWidth( rect["width"].toInt() );
    
    QSize screenSize = QApplication::desktop()->screenGeometry().size();
    QPoint pos = mapToGlobal( QPoint( rect["x"].toInt(), rect["y"].toInt() + rect["height"].toInt() ) );
    menu->popup( pos );
    if( pos.y() + menu->height() > screenSize.height() )
    {
         menu->move( mapToGlobal( QPoint( rect["x"].toInt(), rect["y"].toInt() - menu->height() ) ) );
    }
    action = menu->exec();
    if( action )
    {
         if( action->objectName() == "sendReport" )
         {
              OnSendReportTriggered();
         }
         else if( action->objectName() == "showInFolder" )
         {
              OnShowInFolderTriggered();
         }
    }
    

    Qt 5.9.7 build from source with Debug and Release variant.
    On Debug variant QMenu after call menu->exec() does show correct.
    On Release variant QMenu after call menu->exec() always return 0 (menu don't show).

    Build system on Debian and Ubuntu, try compilers: gcc5, gcc6, gcc7, clang6, clang7.
    Please help. What the problem?

    aha_1980A 1 Reply Last reply
    -1
    • K kas_ru

      I have simple code with QMenu class:

      QMenu* menu = new QMenu( mainWindow_ )
      menu->setSizePolicy( QSizePolicy::Preferred, menu->sizePolicy().verticalPolicy() );
      menu->setFixedWidth( QWIDGETSIZE_MAX );
      menu->clear();
      
      QAction* action;
      
      action = menu->addAction( tr( "Send report" ) );
      action->setObjectName( "sendReport" );
      
      action = menu->addAction( tr( "Show in folder" ) );
      action->setObjectName( "showInFolder" );
      menu->setSizePolicy( QSizePolicy::Fixed, menu->sizePolicy().verticalPolicy() );
      menu->setFixedWidth( rect["width"].toInt() );
      
      QSize screenSize = QApplication::desktop()->screenGeometry().size();
      QPoint pos = mapToGlobal( QPoint( rect["x"].toInt(), rect["y"].toInt() + rect["height"].toInt() ) );
      menu->popup( pos );
      if( pos.y() + menu->height() > screenSize.height() )
      {
           menu->move( mapToGlobal( QPoint( rect["x"].toInt(), rect["y"].toInt() - menu->height() ) ) );
      }
      action = menu->exec();
      if( action )
      {
           if( action->objectName() == "sendReport" )
           {
                OnSendReportTriggered();
           }
           else if( action->objectName() == "showInFolder" )
           {
                OnShowInFolderTriggered();
           }
      }
      

      Qt 5.9.7 build from source with Debug and Release variant.
      On Debug variant QMenu after call menu->exec() does show correct.
      On Release variant QMenu after call menu->exec() always return 0 (menu don't show).

      Build system on Debian and Ubuntu, try compilers: gcc5, gcc6, gcc7, clang6, clang7.
      Please help. What the problem?

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @kas_ru Please don't cross-post. Closing this one as duplicate of https://forum.qt.io/topic/99039/qt-5-9-7-linux-x11-different-behavior-qmenu-on-debug-and-release-build

      Qt has to stay free or it will die.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved