Commit 17516029 authored by Peter Zhigalov's avatar Peter Zhigalov

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

parent e7c424f1
#include "mainwindow.h"
#include <QApplication>
#include <QMenu>
#if defined (USE_STATIC_QJPEG)
Q_IMPORT_PLUGIN(qjpeg)
......@@ -12,6 +13,12 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
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)
{
string filename;
......
......@@ -7,6 +7,9 @@
#include <QColorDialog>
#include <QInputDialog>
#include <QClipboard>
#include <QProcess>
#include <QDir>
#include <QStringList>
#include <algorithm>
#include <cmath>
#include "libs/jo_images.h"
......@@ -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
void MainWindow::on_actionExit_triggered()
{
......
......@@ -44,6 +44,8 @@ private slots:
void on_actionCopy_Image_to_Clipboard_triggered();
// Событие при сохранении
void on_actionSave_Image_File_triggered();
// Событие при нажатии кнопки New Window
void on_actionNew_Window_triggered();
// Событие при нажатии кнопки Exit
void on_actionExit_triggered();
// Событие при изменении уровня интерполяции
......
......@@ -187,6 +187,7 @@
<addaction name="actionCopy_Image_to_Clipboard"/>
<addaction name="actionSave_Image_File"/>
<addaction name="separator"/>
<addaction name="actionNew_Window"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuInterpolation">
......@@ -268,6 +269,11 @@
<string>Ctrl+S</string>
</property>
</action>
<action name="actionNew_Window">
<property name="text">
<string>New Window</string>
</property>
</action>
<action name="actionExit">
<property name="text">
<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