Display MaxiCode at a suitable size in Studio

This is a quick hack - the QT code needs an overhaul
This commit is contained in:
Robin Stuart 2016-10-27 22:34:57 +01:00
parent f5fc3c72d1
commit 9024006ca8

View File

@ -334,8 +334,10 @@ namespace Zint {
qreal gwidth = m_zintSymbol->width; qreal gwidth = m_zintSymbol->width;
qreal gheight = m_zintSymbol->height; qreal gheight = m_zintSymbol->height;
if (m_zintSymbol->symbology == BARCODE_MAXICODE) { if (m_zintSymbol->symbology == BARCODE_MAXICODE) {
gheight *= (maxi_width); // gheight *= (maxi_width);
gwidth *= (maxi_width + 1); // gwidth *= (maxi_width + 1);
gwidth *= 2.0;
gheight *= 2.0;
} }
if (m_zintSymbol->output_options & BARCODE_DOTTY_MODE) { if (m_zintSymbol->output_options & BARCODE_DOTTY_MODE) {
@ -356,13 +358,13 @@ namespace Zint {
textoffset = 0; textoffset = 0;
} }
gwidth += m_zintSymbol->whitespace_width * 2; gwidth += m_zintSymbol->whitespace_width * 2;
switch (mode) { // switch (mode) {
case IgnoreAspectRatio: // case IgnoreAspectRatio:
xsf = (qreal) paintRect.width() / gwidth; // xsf = (qreal) paintRect.width() / gwidth;
ysf = (qreal) paintRect.height() / gheight; // ysf = (qreal) paintRect.height() / gheight;
break; // break;
//
case KeepAspectRatio: // case KeepAspectRatio:
if (paintRect.width() / gwidth < paintRect.height() / gheight) { if (paintRect.width() / gwidth < paintRect.height() / gheight) {
ysf = xsf = (qreal) paintRect.width() / gwidth; ysf = xsf = (qreal) paintRect.width() / gwidth;
ytr += (qreal) (paintRect.height() - gheight * ysf) / 2; ytr += (qreal) (paintRect.height() - gheight * ysf) / 2;
@ -370,13 +372,13 @@ namespace Zint {
ysf = xsf = (qreal) paintRect.height() / gheight; ysf = xsf = (qreal) paintRect.height() / gheight;
xtr += (qreal) (paintRect.width() - gwidth * xsf) / 2; xtr += (qreal) (paintRect.width() - gwidth * xsf) / 2;
} }
break; // break;
case CenterBarCode: // case CenterBarCode:
xtr += ((qreal) paintRect.width() - gwidth * xsf) / 2; // xtr += ((qreal) paintRect.width() - gwidth * xsf) / 2;
ytr += ((qreal) paintRect.height() - gheight * ysf) / 2; // ytr += ((qreal) paintRect.height() - gheight * ysf) / 2;
break; // break;
} // }
painter.setBackground(QBrush(m_bgColor)); painter.setBackground(QBrush(m_bgColor));
painter.fillRect(paintRect, QBrush(m_bgColor)); painter.fillRect(paintRect, QBrush(m_bgColor));