Commit 17516029 authored by Peter Zhigalov's avatar Peter Zhigalov

Добавил пункт меню New Window в проект с Qt

parent e7c424f1
#include "mainwindow.h" #include "mainwindow.h"
#include <QApplication> #include <QApplication>
#include <QMenu>
#if defined (USE_STATIC_QJPEG) #if defined (USE_STATIC_QJPEG)
Q_IMPORT_PLUGIN(qjpeg) Q_IMPORT_PLUGIN(qjpeg)
...@@ -12,6 +13,12 @@ int main(int argc, char *argv[]) ...@@ -12,6 +13,12 @@ int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
MainWindow w; MainWindow w;
#if defined (Q_OS_MAC)
void qt_mac_set_dock_menu(QMenu *menu);
QMenu dock_menu;
dock_menu.addAction("New Window", &w, SLOT(on_actionNew_Window_triggered()));
qt_mac_set_dock_menu(&dock_menu);
#endif
if(argc > 1) if(argc > 1)
{ {
string filename; string filename;
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#include <QColorDialog> #include <QColorDialog>
#include <QInputDialog> #include <QInputDialog>
#include <QClipboard> #include <QClipboard>
#include <QProcess>
#include <QDir>
#include <QStringList>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include "libs/jo_images.h" #include "libs/jo_images.h"
...@@ -399,6 +402,12 @@ void MainWindow::on_actionSave_Image_File_triggered() ...@@ -399,6 +402,12 @@ void MainWindow::on_actionSave_Image_File_triggered()
} }
} }
// Событие при нажатии кнопки New Window
void MainWindow::on_actionNew_Window_triggered()
{
QProcess::startDetached(QApplication::applicationFilePath(), QStringList(), QDir::currentPath());
}
// Событие при нажатии кнопки Exit // Событие при нажатии кнопки Exit
void MainWindow::on_actionExit_triggered() void MainWindow::on_actionExit_triggered()
{ {
......
...@@ -44,6 +44,8 @@ private slots: ...@@ -44,6 +44,8 @@ private slots:
void on_actionCopy_Image_to_Clipboard_triggered(); void on_actionCopy_Image_to_Clipboard_triggered();
// Событие при сохранении // Событие при сохранении
void on_actionSave_Image_File_triggered(); void on_actionSave_Image_File_triggered();
// Событие при нажатии кнопки New Window
void on_actionNew_Window_triggered();
// Событие при нажатии кнопки Exit // Событие при нажатии кнопки Exit
void on_actionExit_triggered(); void on_actionExit_triggered();
// Событие при изменении уровня интерполяции // Событие при изменении уровня интерполяции
......
...@@ -187,6 +187,7 @@ ...@@ -187,6 +187,7 @@
<addaction name="actionCopy_Image_to_Clipboard"/> <addaction name="actionCopy_Image_to_Clipboard"/>
<addaction name="actionSave_Image_File"/> <addaction name="actionSave_Image_File"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionNew_Window"/>
<addaction name="actionExit"/> <addaction name="actionExit"/>
</widget> </widget>
<widget class="QMenu" name="menuInterpolation"> <widget class="QMenu" name="menuInterpolation">
...@@ -268,6 +269,11 @@ ...@@ -268,6 +269,11 @@
<string>Ctrl+S</string> <string>Ctrl+S</string>
</property> </property>
</action> </action>
<action name="actionNew_Window">
<property name="text">
<string>New Window</string>
</property>
</action>
<action name="actionExit"> <action name="actionExit">
<property name="text"> <property name="text">
<string>Exit</string> <string>Exit</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment