Replace deprecated function qt_mac_set_dock_menu() by method

QMenu::setAsDockMenu().

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-02-22 08:09:33 +02:00
parent 4ed5fd9329
commit 915276748c
2 changed files with 6 additions and 2 deletions

View File

@ -138,12 +138,14 @@ TMainWindow::TMainWindow(QWidget *parent)
ui->pushButtonShowInExplorer->setText(tr("Show in Finder")); ui->pushButtonShowInExplorer->setText(tr("Show in Finder"));
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 2)
// Mac OS Dock Menu // Mac OS Dock Menu
QMenu *menu = new QMenu(this); QMenu *menu = new QMenu(this);
connect(menu, &QMenu::aboutToShow, this, &TMainWindow::AboutToShowDockMenu); connect(menu, &QMenu::aboutToShow, this, &TMainWindow::AboutToShowDockMenu);
AboutToShowDockMenu(); AboutToShowDockMenu();
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
menu->setAsDockMenu();
#else
extern void qt_mac_set_dock_menu(QMenu *); extern void qt_mac_set_dock_menu(QMenu *);
qt_mac_set_dock_menu(menu); qt_mac_set_dock_menu(menu);
#endif #endif

View File

@ -204,7 +204,6 @@ MainWindow::MainWindow(QWidget *parent)
setUnifiedTitleAndToolBarOnMac(true); setUnifiedTitleAndToolBarOnMac(true);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 2)
// Mac OS Dock Menu // Mac OS Dock Menu
QMenu *menu = new QMenu(this); QMenu *menu = new QMenu(this);
@ -224,6 +223,9 @@ MainWindow::MainWindow(QWidget *parent)
actionPreferences->setMenuRole(QAction::NoRole); actionPreferences->setMenuRole(QAction::NoRole);
connect(actionPreferences, &QAction::triggered, this, &MainWindow::Preferences); connect(actionPreferences, &QAction::triggered, this, &MainWindow::Preferences);
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
menu->setAsDockMenu();
#else
extern void qt_mac_set_dock_menu(QMenu *); extern void qt_mac_set_dock_menu(QMenu *);
qt_mac_set_dock_menu(menu); qt_mac_set_dock_menu(menu);
#endif #endif