diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui index f09f5c02..fbd25ae1 100644 --- a/frontend_qt/mainWindow.ui +++ b/frontend_qt/mainWindow.ui @@ -561,7 +561,7 @@ p, li { white-space: pre-wrap; } - + @@ -577,7 +577,7 @@ p, li { white-space: pre-wrap; } - + @@ -593,7 +593,7 @@ p, li { white-space: pre-wrap; } - + @@ -606,7 +606,7 @@ p, li { white-space: pre-wrap; } - + Qt::Horizontal @@ -619,8 +619,8 @@ p, li { white-space: pre-wrap; } - - + + 100 @@ -631,7 +631,20 @@ p, li { white-space: pre-wrap; } Copy to clipboard - &Copy + Copy S&VG + + + + + + + + 100 + 0 + + + + &Copy BMP diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index f5beec89..a9e118f6 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -150,7 +150,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) connect(btnMoreData, SIGNAL(clicked( bool )), SLOT(open_data_dialog())); connect(btnSequence, SIGNAL(clicked( bool )), SLOT(open_sequence_dialog())); connect(chkHRTHide, SIGNAL(stateChanged( int )), SLOT(update_preview())); - connect(btnCopy, SIGNAL(clicked( bool )), SLOT(copy_to_clipboard())); + connect(btnCopySVG, SIGNAL(clicked( bool )), SLOT(copy_to_clipboard_svg())); + connect(btnCopyBMP, SIGNAL(clicked( bool )), SLOT(copy_to_clipboard_bmp())); } MainWindow::~MainWindow() @@ -270,14 +271,14 @@ void MainWindow::quit_now() close(); } -void MainWindow::copy_to_clipboard() +void MainWindow::copy_to_clipboard_svg() { QClipboard *clipboard = QGuiApplication::clipboard(); QMimeData *data = new QMimeData; QString filename = ".zint.svg"; double scale = spnScale->value(); - spnScale->setValue(10); + spnScale->setValue(5); if (!m_bc.bc.save_to_file(filename)) { return; @@ -291,6 +292,22 @@ void MainWindow::copy_to_clipboard() spnScale->setValue(scale); } +void MainWindow::copy_to_clipboard_bmp() +{ + QClipboard *clipboard = QGuiApplication::clipboard(); + QMimeData *data = new QMimeData; + QString filename = ".zint.bmp"; + + if (!m_bc.bc.save_to_file(filename)) { + return; + } + + data->setImageData(QImage(filename)); + clipboard->setMimeData(data, QClipboard::Clipboard); + + QFile::remove(filename); +} + void MainWindow::change_options() { QUiLoader uiload; diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index e2cded0a..89902ca2 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -130,7 +130,8 @@ private slots: void reset_view(); int open_data_dialog(); int open_sequence_dialog(); - void copy_to_clipboard(); + void copy_to_clipboard_svg(); + void copy_to_clipboard_bmp(); private: /* void createActions();