#include class MainWindow : public QMainWindow { public: MainWindow(QWidget *parent = 0); ~MainWindow(); }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setUnifiedTitleAndToolBarOnMac(true); QToolBar *tb = addToolBar("ToolBar"); QAction *action = new QAction(this); action->setText(tr("Some Action")); tb->addAction(action); QLabel *info = new QLabel; info->setText("Press Ctrl+Q and hold it => App will crash if workaround is not enabled"); setCentralWidget(info); } MainWindow::~MainWindow() { #ifdef QT_MAC_USE_COCOA // Workaround // setUnifiedTitleAndToolBarOnMac(false); // qApp->processEvents(); #else #error This is a Qt/Cocoa problem only #endif } int main(int argc, char *argv[]) { QApplication a(argc, argv); again: { MainWindow *w = new MainWindow; w->show(); a.exec(); delete w; } goto again; }