mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
added zoom in/out and rotate
This commit is contained in:
parent
b3fb7c5cbf
commit
cad4ff9f57
@ -5,7 +5,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>787</width>
|
<width>873</width>
|
||||||
<height>748</height>
|
<height>748</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -13,10 +13,101 @@
|
|||||||
<string>Zint Qt fontend</string>
|
<string>Zint Qt fontend</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout" >
|
<layout class="QGridLayout" name="gridLayout" >
|
||||||
<item row="0" column="0" colspan="2" >
|
<item row="0" column="0" >
|
||||||
|
<widget class="QPushButton" name="zoomIn" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Ctrl++</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Zoom in</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut" >
|
||||||
|
<string>Ctrl++</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" >
|
||||||
|
<widget class="QPushButton" name="zoomOut" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Ctrl+-</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Zoom out</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut" >
|
||||||
|
<string>Ctrl+-</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" >
|
||||||
|
<spacer name="horizontalSpacer_4" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0" >
|
||||||
|
<size>
|
||||||
|
<width>85</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3" colspan="2" >
|
||||||
|
<widget class="QPushButton" name="reset" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Ctrl+0</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Reset</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut" >
|
||||||
|
<string>Ctrl+0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="5" >
|
||||||
|
<spacer name="horizontalSpacer_3" >
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0" >
|
||||||
|
<size>
|
||||||
|
<width>76</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="6" >
|
||||||
|
<widget class="QPushButton" name="rotateAc" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Ctrl+Left</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Rotate anticlockwise</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut" >
|
||||||
|
<string>Ctrl+Left</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="7" >
|
||||||
|
<widget class="QPushButton" name="rotateC" >
|
||||||
|
<property name="toolTip" >
|
||||||
|
<string>Ctrl+Right</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Rotate clockwise</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut" >
|
||||||
|
<string>Ctrl+Right</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="8" >
|
||||||
<widget class="QGraphicsView" name="view" />
|
<widget class="QGraphicsView" name="view" />
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="2" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label" >
|
||||||
@ -33,7 +124,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="2" column="4" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_12" >
|
<layout class="QHBoxLayout" name="horizontalLayout_12" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_11" >
|
<widget class="QLabel" name="label_11" >
|
||||||
@ -63,7 +154,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
<item row="3" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3" >
|
<layout class="QHBoxLayout" name="horizontalLayout_3" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3" >
|
<widget class="QLabel" name="label_3" >
|
||||||
@ -87,7 +178,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" >
|
<item row="3" column="4" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_13" >
|
<layout class="QHBoxLayout" name="horizontalLayout_13" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_12" >
|
<widget class="QLabel" name="label_12" >
|
||||||
@ -117,7 +208,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" >
|
<item row="4" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5" >
|
<layout class="QHBoxLayout" name="horizontalLayout_5" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_5" >
|
<widget class="QLabel" name="label_5" >
|
||||||
@ -141,7 +232,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" >
|
<item row="4" column="4" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4" >
|
<layout class="QHBoxLayout" name="horizontalLayout_4" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4" >
|
<widget class="QLabel" name="label_4" >
|
||||||
@ -158,7 +249,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" >
|
<item row="5" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_6" >
|
<layout class="QHBoxLayout" name="horizontalLayout_6" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_6" >
|
<widget class="QLabel" name="label_6" >
|
||||||
@ -185,7 +276,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item rowspan="8" row="4" column="1" >
|
<item rowspan="8" row="5" column="4" colspan="4" >
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2" >
|
<widget class="QLabel" name="label_2" >
|
||||||
@ -210,7 +301,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" >
|
<item row="6" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7" >
|
<layout class="QHBoxLayout" name="horizontalLayout_7" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_7" >
|
<widget class="QLabel" name="label_7" >
|
||||||
@ -237,7 +328,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0" >
|
<item row="7" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_8" >
|
<layout class="QHBoxLayout" name="horizontalLayout_8" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_8" >
|
<widget class="QLabel" name="label_8" >
|
||||||
@ -264,7 +355,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" >
|
<item row="8" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_10" >
|
<layout class="QHBoxLayout" name="horizontalLayout_10" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_9" >
|
<widget class="QLabel" name="label_9" >
|
||||||
@ -297,7 +388,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0" >
|
<item row="9" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_11" >
|
<layout class="QHBoxLayout" name="horizontalLayout_11" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_10" >
|
<widget class="QLabel" name="label_10" >
|
||||||
@ -324,7 +415,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0" >
|
<item row="10" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_14" >
|
<layout class="QHBoxLayout" name="horizontalLayout_14" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_13" >
|
<widget class="QLabel" name="label_13" >
|
||||||
@ -367,7 +458,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="0" >
|
<item row="11" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_15" >
|
<layout class="QHBoxLayout" name="horizontalLayout_15" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_14" >
|
<widget class="QLabel" name="label_14" >
|
||||||
@ -395,7 +486,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="11" column="0" >
|
<item row="12" column="0" colspan="4" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_9" >
|
<layout class="QHBoxLayout" name="horizontalLayout_9" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="fgcolor" >
|
<widget class="QPushButton" name="fgcolor" >
|
||||||
@ -413,7 +504,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="0" colspan="2" >
|
<item row="13" column="0" colspan="8" >
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer" >
|
<spacer name="horizontalSpacer" >
|
||||||
|
@ -22,16 +22,37 @@
|
|||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
||||||
: QWidget(parent, fl)
|
: QWidget(parent, fl)
|
||||||
{
|
{
|
||||||
|
char bstyle_text[][40] = {
|
||||||
|
"Code 11", "Code 2 of 5 Matrix", "Code 2 of 5 Interleaved", "IATA Code 2 of 5",
|
||||||
|
"Code 2 of 5 Data Logic", "Code 2 of 5 Industrial", "Code 39", "Extended Code 39",
|
||||||
|
"EAN", "EAN-128", "Codabar", "Code 128", "DP Leitcode", "DP Identcode",
|
||||||
|
"Code 16k", "Code 93", "Flattermarken", "Databar",
|
||||||
|
"Databar Limited", "Databar Expanded", "Telepen", "UPC-A", "UPC-E",
|
||||||
|
"Postnet", "MSI Plessey", "FIM", "LOGMARS", "Pharmacode", "PZN",
|
||||||
|
"Pharmacode 2-track", "PDF417", "PDF417 Truncated", "Maxicode",
|
||||||
|
"QR Code", "Code 128 Subset B", "Auspost Standard", "Auspost Reply",
|
||||||
|
"Auspost Route", "Auspost Redirect", "ISBN", "Royal Mail 4-state",
|
||||||
|
"Data Matrix", "EAN-14", "Codablock-F", "NVE-18", "Databar Stacked",
|
||||||
|
"Databar Stacked Omni", "Databar Expanded Stacked", "PLANET",
|
||||||
|
"MicroPDF417", "USPS One Code", "UK Plessey", "Telepen Numeric",
|
||||||
|
"ITF-14", "Dutch Post KIX", "Aztec Code", "Code 32",
|
||||||
|
"Composite EAN", "Composite EAN-128", "Composite Databar",
|
||||||
|
"Composite Databar Limited", "Composite Databar Expanded",
|
||||||
|
"Composite UPC-A", "Composite UPC-E", "Composite Databar Stacked",
|
||||||
|
"Composite Databar Stacked Omni", "Composite Databar Expanded Stacked"
|
||||||
|
};
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
view->setScene(new QGraphicsScene);
|
view->setScene(new QGraphicsScene);
|
||||||
m_fgcolor=qRgb(0,0,0);
|
m_fgcolor=qRgb(0,0,0);
|
||||||
m_bgcolor=qRgb(0xff,0xff,0xff);
|
m_bgcolor=qRgb(0xff,0xff,0xff);
|
||||||
for (int i=0;i<metaObject()->enumerator(0).keyCount();i++)
|
for (int i=0;i<metaObject()->enumerator(0).keyCount();i++) {
|
||||||
bstyle->addItem(metaObject()->enumerator(0).key(i));
|
bstyle->addItem(metaObject()->enumerator(0).key(i));
|
||||||
|
bstyle->setItemText(i,bstyle_text[i]);
|
||||||
|
}
|
||||||
|
bstyle->setCurrentIndex(11);
|
||||||
on_generate_clicked();
|
on_generate_clicked();
|
||||||
view->scene()->addItem(&m_bc);
|
view->scene()->addItem(&m_bc);
|
||||||
connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked()));
|
connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked()));
|
||||||
@ -98,3 +119,25 @@ void MainWindow::on_generate_clicked()
|
|||||||
view->scene()->update();
|
view->scene()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_zoomIn_clicked()
|
||||||
|
{
|
||||||
|
view->scale(1.2,1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_zoomOut_clicked()
|
||||||
|
{
|
||||||
|
view->scale(0.9,0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_rotateAc_clicked()
|
||||||
|
{
|
||||||
|
view->rotate(-5);
|
||||||
|
}
|
||||||
|
void MainWindow::on_rotateC_clicked()
|
||||||
|
{
|
||||||
|
view->rotate(5);
|
||||||
|
}
|
||||||
|
void MainWindow::on_reset_clicked()
|
||||||
|
{
|
||||||
|
view->resetTransform();
|
||||||
|
}
|
||||||
|
@ -47,7 +47,6 @@ public:
|
|||||||
DPLEIT =21,
|
DPLEIT =21,
|
||||||
DPIDENT =22,
|
DPIDENT =22,
|
||||||
CODE16K =23,
|
CODE16K =23,
|
||||||
CODE49 =24,
|
|
||||||
CODE93 =25,
|
CODE93 =25,
|
||||||
FLAT =28,
|
FLAT =28,
|
||||||
RSS14 =29,
|
RSS14 =29,
|
||||||
@ -78,7 +77,6 @@ public:
|
|||||||
EAN14 =72,
|
EAN14 =72,
|
||||||
CODABLOCKF =74,
|
CODABLOCKF =74,
|
||||||
NVE18 =75,
|
NVE18 =75,
|
||||||
KOREAPOST =77,
|
|
||||||
RSS14STACK =79,
|
RSS14STACK =79,
|
||||||
RSS14STACK_OMNI =80,
|
RSS14STACK_OMNI =80,
|
||||||
RSS_EXPSTACK =81,
|
RSS_EXPSTACK =81,
|
||||||
@ -92,8 +90,6 @@ public:
|
|||||||
ITF14 =89,
|
ITF14 =89,
|
||||||
KIX =90,
|
KIX =90,
|
||||||
AZTEC =92,
|
AZTEC =92,
|
||||||
DAFT =93,
|
|
||||||
MICROQR =97,
|
|
||||||
|
|
||||||
/* Zint specific */
|
/* Zint specific */
|
||||||
CODE32 =129,
|
CODE32 =129,
|
||||||
@ -117,6 +113,11 @@ public slots:
|
|||||||
void on_generate_clicked();
|
void on_generate_clicked();
|
||||||
void on_fgcolor_clicked();
|
void on_fgcolor_clicked();
|
||||||
void on_bgcolor_clicked();
|
void on_bgcolor_clicked();
|
||||||
|
void on_zoomIn_clicked();
|
||||||
|
void on_zoomOut_clicked();
|
||||||
|
void on_rotateAc_clicked();
|
||||||
|
void on_rotateC_clicked();
|
||||||
|
void on_reset_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor m_fgcolor,m_bgcolor;
|
QColor m_fgcolor,m_bgcolor;
|
||||||
|
Loading…
Reference in New Issue
Block a user