mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Add option to copy to clipboard
This commit is contained in:
parent
92f02c8a67
commit
536f217e78
@ -308,8 +308,8 @@ Remember to place [square brackets] around AI data</string>
|
|||||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Noto Sans [monotype]'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif';">Your Data Here!</span></p></body></html></string>
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Your Data Here!</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptRichText">
|
<property name="acceptRichText">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -619,6 +619,19 @@ p, li { white-space: pre-wrap; }
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="btnCopy">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Copy</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QMimeData>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "datawindow.h"
|
#include "datawindow.h"
|
||||||
@ -148,6 +150,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
|
|||||||
connect(btnMoreData, SIGNAL(clicked( bool )), SLOT(open_data_dialog()));
|
connect(btnMoreData, SIGNAL(clicked( bool )), SLOT(open_data_dialog()));
|
||||||
connect(btnSequence, SIGNAL(clicked( bool )), SLOT(open_sequence_dialog()));
|
connect(btnSequence, SIGNAL(clicked( bool )), SLOT(open_sequence_dialog()));
|
||||||
connect(chkHRTHide, SIGNAL(stateChanged( int )), SLOT(update_preview()));
|
connect(chkHRTHide, SIGNAL(stateChanged( int )), SLOT(update_preview()));
|
||||||
|
connect(btnCopy, SIGNAL(clicked( bool )), SLOT(copy_to_clipboard()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -267,6 +270,22 @@ void MainWindow::quit_now()
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::copy_to_clipboard()
|
||||||
|
{
|
||||||
|
QClipboard *clipboard = QGuiApplication::clipboard();
|
||||||
|
QMimeData *data = new QMimeData;
|
||||||
|
QString filename = ".zint.gif";
|
||||||
|
|
||||||
|
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()
|
void MainWindow::change_options()
|
||||||
{
|
{
|
||||||
QUiLoader uiload;
|
QUiLoader uiload;
|
||||||
|
@ -130,6 +130,7 @@ private slots:
|
|||||||
void reset_view();
|
void reset_view();
|
||||||
int open_data_dialog();
|
int open_data_dialog();
|
||||||
int open_sequence_dialog();
|
int open_sequence_dialog();
|
||||||
|
void copy_to_clipboard();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* void createActions();
|
/* void createActions();
|
||||||
|
Loading…
Reference in New Issue
Block a user