mirror of
https://git.code.sf.net/p/zint/code
synced 2025-06-03 08:28:44 -04:00
First attempt at "Copy"
This commit is contained in:
parent
1889644208
commit
249d33ee14
5 changed files with 985 additions and 28 deletions
|
@ -6,7 +6,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>749</width>
|
||||
<height>741</height>
|
||||
<height>744</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
|
@ -179,7 +179,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>727</width>
|
||||
<height>248</height>
|
||||
<height>243</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="title" >
|
||||
|
@ -335,8 +335,8 @@
|
|||
<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">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</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; font-family:'DejaVu Sans';"><span style=" font-family:'Sans Serif';">Your Data Here!</span></p></body></html></string>
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; 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; font-family:'DejaVu Sans'; font-size:9pt;"><span style=" font-family:'Sans Serif';">Your Data Here!</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="acceptRichText" >
|
||||
<bool>false</bool>
|
||||
|
@ -568,7 +568,7 @@ p, li { white-space: pre-wrap; }
|
|||
<item>
|
||||
<widget class="QPushButton" name="btnCopy" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Copy</string>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <QColorDialog>
|
||||
#include <QUiLoader>
|
||||
#include <QFile>
|
||||
#include <QClipboard>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include <stdio.h>
|
||||
|
@ -125,6 +126,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
|||
connect(btnSave, SIGNAL(clicked( bool )), SLOT(save()));
|
||||
connect(spnScale, SIGNAL(valueChanged( double )), SLOT(change_print_scale()));
|
||||
connect(btnExit, SIGNAL(clicked( bool )), SLOT(quit_now()));
|
||||
connect(btnCopy, SIGNAL(clicked( bool )), SLOT(copy_to_clipboard()));
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -137,27 +139,6 @@ void MainWindow::scaleRotate()
|
|||
view->scale((double)scaleSlider->value()/100,(double)scaleSlider->value()/100);
|
||||
}
|
||||
|
||||
/*
|
||||
void MainWindow::createActions()
|
||||
{
|
||||
saveAct = new QAction(tr("&Save"), this);
|
||||
saveAct->setShortcut(tr("Ctrl+S"));
|
||||
saveAct->setStatusTip(tr("Save the document to disk"));
|
||||
connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
|
||||
aboutQtAct = new QAction(tr("About &Qt"), this);
|
||||
aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
|
||||
connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||
}
|
||||
|
||||
void MainWindow::createMenus()
|
||||
{
|
||||
fileMenu = menuBar()->addMenu(tr("&File"));
|
||||
fileMenu->addAction(saveAct);
|
||||
fileMenu->addAction(exitAction);
|
||||
helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||
helpMenu->addAction(aboutQtAct);
|
||||
} */
|
||||
|
||||
bool MainWindow::save()
|
||||
{
|
||||
bool status;
|
||||
|
@ -177,6 +158,18 @@ bool MainWindow::save()
|
|||
return status;
|
||||
}
|
||||
|
||||
void MainWindow::copy_to_clipboard()
|
||||
{
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
QString clip_data_str = m_bc.bc.copy_to_clipboard();
|
||||
QByteArray clip_data_ba = clip_data_str.toUtf8();
|
||||
QMimeData *clip_data_mime = new QMimeData;
|
||||
clip_data_mime->setData("image/svg+xml", clip_data_ba);
|
||||
clipboard->setMimeData(clip_data_mime, QClipboard::Clipboard);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void MainWindow::about()
|
||||
{
|
||||
QMessageBox::about(this, tr("About Zint"),
|
||||
|
|
|
@ -122,7 +122,7 @@ private slots:
|
|||
bool save();
|
||||
void about();
|
||||
void quit_now();
|
||||
|
||||
void copy_to_clipboard();
|
||||
|
||||
private:
|
||||
/* void createActions();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue