QMenuBar's height has suddenly changed - bug?



  • 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?


  • Lifetime Qt Champion

    Hi,

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

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.