I'm writing newbie Qt5(.4.0) code on OSX Mavericks. Here's my self-contained test case:
#include <QApplication>
#include <QMainWindow>
#include <QtGui>
#include <QMenuBar>
#include <QGridLayout>
#include <QPushButton>
int
main( int argc, char *argv[] ) {
QApplication app( argc, argv );
QMainWindow* mw = new QMainWindow();
mw->menuBar()->setNativeMenuBar( false );
QMenu* fileMenu = mw->menuBar()->addMenu( "&File" );
QMenu* optionsMenu = mw->menuBar()->addMenu( "&Options" );
QWidget* menuCorner = new QWidget( mw->menuBar() );
QGridLayout* cornerLayout = new QGridLayout();
QPushButton* newWindowButton = new QPushButton( "New Window" );
cornerLayout->addWidget( newWindowButton, 1, 0 );
menuCorner->setLayout( cornerLayout );
mw->menuBar()->setCornerWidget( menuCorner );
mw->show();
return app.exec();
}
The "New Window" pushbutton shows up at the right side of the menubar, as intended, however the bottom half of the "New Window" pushbutton is clipped, and thus hidden, by the bottom separator line for the menubar:
How can I make the new corner-widget pushbutton appear fully in the menubar without getting clipped?
Thanks