Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.0
-
None
-
None
-
Mac OSX 10.6.2, Qt4.7-TP (Cocoa)
-
327fabf8e8819b199aa24912ffe6893020b465d4
Description
When creating a default menu bar on a Mac, newly added menu actions are permanently disabled.
Running this exact code using Qt4.6.2 (Cocoa) works as expected.
WindowManager.h
#include <QObject> class WindowManager : public QObject { Q_OBJECT public: WindowManager(QObject *parent = 0); private slots: void slotAboutToShowFileMenu(); void slotNewWindow(); };
WindowManager.cpp
#include <QtDebug> #include <QMenuBar> #include "WindowManager.h" WindowManager::WindowManager(QObject *parent) : QObject(parent) { QMenuBar *mb = new QMenuBar(0); QMenu *fileMenu = mb->addMenu(tr("&File")); QAction *act = fileMenu->addAction(tr("&New"), this, SLOT(slotNewWindow()), QKeySequence(Qt::CTRL | Qt::Key_N)); act->setEnabled(true); connect(fileMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShowFileMenu())); } void WindowManager::slotAboutToShowFileMenu() { qDebug("slotAboutToShowFileMenu"); } void WindowManager::slotNewWindow() { qDebug("slotNewWindow"); }
Unable to find source-code formatter for language: main.cpp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
#include <QApplication> #include "WindowManager.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); new WindowManager; return a.exec(); }