From cad4ff9f574e5ad6524fb73749a962b22cbf41d1 Mon Sep 17 00:00:00 2001 From: taipanromania Date: Tue, 7 Oct 2008 14:28:32 +0000 Subject: [PATCH] added zoom in/out and rotate --- frontend_qt4/mainWindow.ui | 127 +++++++++++++++++++++++++++++++----- frontend_qt4/mainwindow.cpp | 47 ++++++++++++- frontend_qt4/mainwindow.h | 9 +-- 3 files changed, 159 insertions(+), 24 deletions(-) diff --git a/frontend_qt4/mainWindow.ui b/frontend_qt4/mainWindow.ui index 871bc917..0c2b772b 100644 --- a/frontend_qt4/mainWindow.ui +++ b/frontend_qt4/mainWindow.ui @@ -5,7 +5,7 @@ 0 0 - 787 + 873 748 @@ -13,10 +13,101 @@ Zint Qt fontend - + + + + Ctrl++ + + + Zoom in + + + Ctrl++ + + + + + + + Ctrl+- + + + Zoom out + + + Ctrl+- + + + + + + + Qt::Horizontal + + + + 85 + 20 + + + + + + + + Ctrl+0 + + + Reset + + + Ctrl+0 + + + + + + + Qt::Horizontal + + + + 76 + 20 + + + + + + + + Ctrl+Left + + + Rotate anticlockwise + + + Ctrl+Left + + + + + + + Ctrl+Right + + + Rotate clockwise + + + Ctrl+Right + + + + - + @@ -33,7 +124,7 @@ - + @@ -63,7 +154,7 @@ - + @@ -87,7 +178,7 @@ - + @@ -117,7 +208,7 @@ - + @@ -141,7 +232,7 @@ - + @@ -158,7 +249,7 @@ - + @@ -185,7 +276,7 @@ - + @@ -210,7 +301,7 @@ p, li { white-space: pre-wrap; } - + @@ -237,7 +328,7 @@ p, li { white-space: pre-wrap; } - + @@ -264,7 +355,7 @@ p, li { white-space: pre-wrap; } - + @@ -297,7 +388,7 @@ p, li { white-space: pre-wrap; } - + @@ -324,7 +415,7 @@ p, li { white-space: pre-wrap; } - + @@ -367,7 +458,7 @@ p, li { white-space: pre-wrap; } - + @@ -395,7 +486,7 @@ p, li { white-space: pre-wrap; } - + @@ -413,7 +504,7 @@ p, li { white-space: pre-wrap; } - + diff --git a/frontend_qt4/mainwindow.cpp b/frontend_qt4/mainwindow.cpp index c1b6759c..cbbb6195 100644 --- a/frontend_qt4/mainwindow.cpp +++ b/frontend_qt4/mainwindow.cpp @@ -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;ienumerator(0).keyCount();i++) + for (int i=0;ienumerator(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(); +} diff --git a/frontend_qt4/mainwindow.h b/frontend_qt4/mainwindow.h index 9ff74f61..65b26355 100644 --- a/frontend_qt4/mainwindow.h +++ b/frontend_qt4/mainwindow.h @@ -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;