mirror of
https://github.com/woo-j/zint.git
synced 2024-12-23 13:33:55 +03:00
added zoom in/out and rotate
This commit is contained in:
parent
b3fb7c5cbf
commit
cad4ff9f57
@ -5,7 +5,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>787</width>
|
||||
<width>873</width>
|
||||
<height>748</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -13,10 +13,101 @@
|
||||
<string>Zint Qt fontend</string>
|
||||
</property>
|
||||
<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" />
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<item row="2" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label" >
|
||||
@ -33,7 +124,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<item row="2" column="4" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11" >
|
||||
@ -63,7 +154,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<item row="3" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
@ -87,7 +178,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<item row="3" column="4" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_12" >
|
||||
@ -117,7 +208,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<item row="4" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5" >
|
||||
@ -141,7 +232,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<item row="4" column="4" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
@ -158,7 +249,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<item row="5" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6" >
|
||||
@ -185,7 +276,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item rowspan="8" row="4" column="1" >
|
||||
<item rowspan="8" row="5" column="4" colspan="4" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2" >
|
||||
@ -210,7 +301,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0" >
|
||||
<item row="6" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_7" >
|
||||
@ -237,7 +328,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" >
|
||||
<item row="7" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_8" >
|
||||
@ -264,7 +355,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="7" column="0" >
|
||||
<item row="8" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9" >
|
||||
@ -297,7 +388,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="8" column="0" >
|
||||
<item row="9" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10" >
|
||||
@ -324,7 +415,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="9" column="0" >
|
||||
<item row="10" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_13" >
|
||||
@ -367,7 +458,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="10" column="0" >
|
||||
<item row="11" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_15" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_14" >
|
||||
@ -395,7 +486,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="11" column="0" >
|
||||
<item row="12" column="0" colspan="4" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9" >
|
||||
<item>
|
||||
<widget class="QPushButton" name="fgcolor" >
|
||||
@ -413,7 +504,7 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2" >
|
||||
<item row="13" column="0" colspan="8" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<item>
|
||||
<spacer name="horizontalSpacer" >
|
||||
|
@ -22,16 +22,37 @@
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent, Qt::WFlags 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);
|
||||
view->setScene(new QGraphicsScene);
|
||||
m_fgcolor=qRgb(0,0,0);
|
||||
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->setItemText(i,bstyle_text[i]);
|
||||
}
|
||||
bstyle->setCurrentIndex(11);
|
||||
on_generate_clicked();
|
||||
view->scene()->addItem(&m_bc);
|
||||
connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked()));
|
||||
@ -98,3 +119,25 @@ void MainWindow::on_generate_clicked()
|
||||
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,
|
||||
DPIDENT =22,
|
||||
CODE16K =23,
|
||||
CODE49 =24,
|
||||
CODE93 =25,
|
||||
FLAT =28,
|
||||
RSS14 =29,
|
||||
@ -78,7 +77,6 @@ public:
|
||||
EAN14 =72,
|
||||
CODABLOCKF =74,
|
||||
NVE18 =75,
|
||||
KOREAPOST =77,
|
||||
RSS14STACK =79,
|
||||
RSS14STACK_OMNI =80,
|
||||
RSS_EXPSTACK =81,
|
||||
@ -92,8 +90,6 @@ public:
|
||||
ITF14 =89,
|
||||
KIX =90,
|
||||
AZTEC =92,
|
||||
DAFT =93,
|
||||
MICROQR =97,
|
||||
|
||||
/* Zint specific */
|
||||
CODE32 =129,
|
||||
@ -117,6 +113,11 @@ public slots:
|
||||
void on_generate_clicked();
|
||||
void on_fgcolor_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:
|
||||
QColor m_fgcolor,m_bgcolor;
|
||||
|
Loading…
Reference in New Issue
Block a user