Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QMenuBar's height has suddenly changed - bug?
Forum Updated to NodeBB v4.3 + New Features

QMenuBar's height has suddenly changed - bug?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 605 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.
  • L Offline
    L Offline
    lucadanieli
    wrote on last edited by lucadanieli
    #1

    I had a QWidget displaying a complex layout containing many widgets.

    The code was approximately:

    #ifndef Q_OS_MAC
        QMenuBar *newMenu = createMenus();
        outerLayout->addWidget(newMenu);
    #endif
    
    QHBoxLayout * h_layout = new QHBoxLayout;
    h_layout->setContentsMargins(0,0,0,0);
    h_layout->setSpacing(0);
    h_layout->addWidget(newDocumentsDocklet);
    h_layout->addWidget(newEditorsDocklet);
    
    outerLayout->addLayout(h_layout);
    window->setLayout(outerLayout);
    

    This is the result:

    alt text

    Unfortunately, when I changed my h_layout from QHBoxLayout to QSplitter, the QMenuBar changed its height. I don't understand if this is a bug, as I thought the the QMenuBar had a specific height.

    The new code looks like this:

    #ifndef Q_OS_MAC
        QMenuBar *newMenu = createMenus();
        outerLayout->addWidget(newMenu);
    #endif
    
    QSplitter * h_layout = new QSplitter;
    h_layout->setOrientation(Qt::Horizontal);
    h_layout->addWidget(newDocumentsDocklet);
    h_layout->addWidget(newEditorsDocklet);
    
    outerLayout->addWidget(h_layout);
    window->setLayout(outerLayout);
    

    This is the new rendering:

    alt text

    Is somebody able to help me understand why this happens?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you provide a minimal complete sample code that shows that behaviour ?

      What version of Qt are you using ? On what Linux distribution ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

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