Commit 2e02ba8b authored by Peter Zhigalov's avatar Peter Zhigalov

Добавил возможность копирования картинки в буфер обмена

parent 66bf6b9c
......@@ -6,6 +6,7 @@
#include <QPrinter>
#include <QColorDialog>
#include <QInputDialog>
#include <QClipboard>
#include <algorithm>
#include <cmath>
#include "libs/jo_images.h"
......@@ -190,6 +191,15 @@ void MainWindow::on_actionOpen_Tecplot_File_triggered()
open_file(fileName);
}
// Событие при копировании картинки в буфер обмена
void MainWindow::on_actionCopy_Image_to_Clipboard_triggered()
{
QImage image(ui->widget->width(), ui->widget->height(), QImage::Format_ARGB32_Premultiplied);
ui->widget->draw(& image, ui->actionTransparent_Image->isChecked(), true);
QClipboard * clipboard = QApplication::clipboard();
clipboard->setImage(image);
}
// Событие при сохранении
void MainWindow::on_actionSave_Image_File_triggered()
{
......
......@@ -40,6 +40,8 @@ public:
private slots:
// Событие при открытии файла
void on_actionOpen_Tecplot_File_triggered();
// Событие при копировании картинки в буфер обмена
void on_actionCopy_Image_to_Clipboard_triggered();
// Событие при сохранении
void on_actionSave_Image_File_triggered();
// Событие при нажатии кнопки Exit
......
......@@ -184,6 +184,7 @@
<addaction name="actionOpen_Tecplot_File"/>
<addaction name="separator"/>
<addaction name="actionTransparent_Image"/>
<addaction name="actionCopy_Image_to_Clipboard"/>
<addaction name="actionSave_Image_File"/>
<addaction name="separator"/>
<addaction name="actionExit"/>
......@@ -248,6 +249,14 @@
<string>Ctrl+O</string>
</property>
</action>
<action name="actionCopy_Image_to_Clipboard">
<property name="text">
<string>Copy Image to Clipboard</string>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
</action>
<action name="actionSave_Image_File">
<property name="text">
<string>Save Image File...</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