diff --git a/frontend_qt4/barcodeitem.cpp b/frontend_qt4/barcodeitem.cpp index dba4329f..090f17ff 100644 --- a/frontend_qt4/barcodeitem.cpp +++ b/frontend_qt4/barcodeitem.cpp @@ -36,7 +36,7 @@ QRectF BarcodeItem::boundingRect() const void BarcodeItem::paint(QPainter * painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/) { - bc.render(*painter,boundingRect(),Zint::QZint::IgnoreAspectRatio); + bc.render(*painter,boundingRect(),ar); } diff --git a/frontend_qt4/barcodeitem.h b/frontend_qt4/barcodeitem.h index 3f23dc4c..165e654e 100644 --- a/frontend_qt4/barcodeitem.h +++ b/frontend_qt4/barcodeitem.h @@ -35,6 +35,7 @@ public: public: mutable Zint::QZint bc; int w,h; + Zint::QZint::AspectRatioMode ar; }; #endif diff --git a/frontend_qt4/mainWindow.ui b/frontend_qt4/mainWindow.ui index 521d9bd5..3b412b17 100644 --- a/frontend_qt4/mainWindow.ui +++ b/frontend_qt4/mainWindow.ui @@ -127,9 +127,9 @@ - + - Item Width: + Aspect ratio: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -137,19 +137,22 @@ - - - 10 - - - 1000 - - - 5 - - - 400 - + + + + Ignore aspect ratio + + + + + Keep aspect ratio + + + + + Center (no scalling) + + @@ -179,11 +182,11 @@ - + - + - Item Height: + Item Width: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -191,7 +194,7 @@ - + 10 @@ -233,11 +236,11 @@ - + - + - Primary + Item Height: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -245,7 +248,20 @@ - + + + 10 + + + 1000 + + + 5 + + + 400 + + @@ -276,28 +292,20 @@ - - + + - + - Data + Primary + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - <!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:'DejaVu Sans'; 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:'Sans Serif'; font-size:10pt;">123456</p></body></html> - - - false - - + @@ -328,6 +336,31 @@ p, li { white-space: pre-wrap; } + + + + + + Data + + + + + + + <!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:'DejaVu Sans'; 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:'Sans Serif'; font-size:10pt;">123456</p></body></html> + + + false + + + + + diff --git a/frontend_qt4/mainwindow.cpp b/frontend_qt4/mainwindow.cpp index e8cf1c3e..b697c3d2 100644 --- a/frontend_qt4/mainwindow.cpp +++ b/frontend_qt4/mainwindow.cpp @@ -66,6 +66,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl) connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked())); connect(primary, SIGNAL(textChanged( const QString& )), SLOT(on_generate_clicked())); connect(text, SIGNAL(textChanged()), SLOT(on_generate_clicked())); + connect(aspectRatio, SIGNAL(currentIndexChanged( int )), SLOT(on_generate_clicked())); } @@ -90,6 +91,7 @@ void MainWindow::on_generate_clicked() QString error; m_bc.w=iwidth->value(); m_bc.h=iheight->value(); + m_bc.ar=(Zint::QZint::AspectRatioMode)aspectRatio->currentIndex(); m_bc.bc.setText(text->toPlainText()); m_bc.bc.setPrimaryMessage(primary->text()); m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex()));