MacIntegration::MacIntegration(QObject *parent) : QObject(parent) { connect(MyPrivate::instance(), SIGNAL(dockClicked()), SIGNAL(dockClicked())); connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), SLOT(onFocusChanged(QWidget*,QWidget*))); MyPrivate::installCustomFrame(); MyPrivate::setCustomBorderColor(QColor(126, 161, 177)); MyPrivate::setCustomTitleColor(QColor(255, 255, 255)); // init menus _macMenuBar = new QMenuBar(NULL); _windowMenu = new QMenu; _windowMenu->menuAction()->setText("Window"); _macMenuBar->addMenu(_windowMenu); closeAction = new QAction("Close Window", _windowMenu); closeAction->setShortcut(QKeySequence("Ctrl+W")); connect(closeAction, SIGNAL(triggered()), SLOT(onCloseAction())); _windowMenu->addAction(closeAction); minimizeAction = new QAction("Minimize", _windowMenu); minimizeAction->setShortcut(QKeySequence("Ctrl+M")); connect(minimizeAction, SIGNAL(triggered()), SLOT(onMinimizeAction())); _windowMenu->addAction(minimizeAction); zoomAction = new QAction("Zoom", _windowMenu); connect(zoomAction, SIGNAL(triggered()), SLOT(onZoomAction())); _windowMenu->addAction(zoomAction); _dockMenu = new QMenu; _dockMenu->addAction("Test!"); qt_mac_set_dock_menu(_dockMenu); }
int main(int argc, char *argv[]) { if (!TanoApplication::preInit(argc, argv)) return -10; TanoApplication instance(argc, argv); // Is another instance of the program is already running if (!instance.shouldContinue()) return 0; if (!instance.postInit()) return -10; MainWindow main(instance.arguments()); main.show(); QObject::connect(&instance, SIGNAL(activate()), &main, SLOT(single())); QObject::connect(&instance, SIGNAL(dockClicked()), &main, SLOT(dockClicked())); return instance.exec(); }
void FDNDApplication::onClickOnDock() { LogManager::appendLine("[FDNDApplication] Dock clicked"); emit dockClicked(); }