2008-07-19 02:48:31 +12:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2008 by BogDan Vatra *
|
|
|
|
* bogdan@licentia.eu *
|
|
|
|
* *
|
|
|
|
* This program is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
#include "qzint.h"
|
2008-07-19 02:48:31 +12:00
|
|
|
|
|
|
|
namespace Zint
|
|
|
|
{
|
|
|
|
|
2008-10-09 22:56:54 +13:00
|
|
|
static const qreal maxi_diagonal=11;
|
|
|
|
static const qreal maxi_width=1.73205807568877*maxi_diagonal/2;
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
QZint::QZint()
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
m_symbol=BARCODE_CODE128;
|
|
|
|
m_height=50;
|
|
|
|
m_border=NO_BORDER;
|
2008-10-09 22:56:54 +13:00
|
|
|
m_boderWidth=1;
|
2008-07-19 02:48:31 +12:00
|
|
|
m_securityLevel=-1;
|
|
|
|
m_pdf417CodeWords=928;
|
|
|
|
m_fgColor=Qt::black;
|
|
|
|
m_bgColor=Qt::white;
|
|
|
|
m_zintSymbol=0;
|
2008-09-18 05:36:08 +12:00
|
|
|
m_excode39SymbologyNumber=m_code39SymbologyNumber=m_msiSymbologyNumber=0;
|
|
|
|
m_error=0;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
QZint::~QZint()
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
if (m_zintSymbol)
|
|
|
|
ZBarcode_Delete(m_zintSymbol);
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::encode()
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
if (m_zintSymbol)
|
|
|
|
ZBarcode_Delete(m_zintSymbol);
|
|
|
|
|
|
|
|
m_lastError.clear();
|
|
|
|
m_zintSymbol = ZBarcode_Create();
|
2008-11-04 02:31:23 +13:00
|
|
|
m_zintSymbol->output_options=m_border;
|
2008-07-19 02:48:31 +12:00
|
|
|
m_zintSymbol->symbology=m_symbol;
|
|
|
|
m_zintSymbol->height=m_height;
|
|
|
|
m_zintSymbol->output_options=0;
|
|
|
|
m_zintSymbol->whitespace_width=0;
|
2008-11-04 02:31:23 +13:00
|
|
|
m_zintSymbol->border_width=m_boderWidth;
|
2008-07-19 02:48:31 +12:00
|
|
|
m_zintSymbol->option_1=m_securityLevel;
|
2008-09-18 05:36:08 +12:00
|
|
|
switch (m_symbol)
|
|
|
|
{
|
|
|
|
case BARCODE_MSI_PLESSEY:
|
|
|
|
m_zintSymbol->option_2=m_msiSymbologyNumber;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BARCODE_CODE39:
|
|
|
|
m_zintSymbol->option_2=m_code39SymbologyNumber;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case BARCODE_EXCODE39:
|
|
|
|
m_zintSymbol->option_2=m_excode39SymbologyNumber;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
m_zintSymbol->option_2=m_width;
|
|
|
|
break;
|
|
|
|
}
|
2008-07-19 02:48:31 +12:00
|
|
|
m_zintSymbol->option_3=m_pdf417CodeWords;
|
|
|
|
QByteArray bstr=m_text.toAscii();
|
|
|
|
QByteArray pstr=m_primaryMessage.left(99).toAscii();
|
|
|
|
strcpy(m_zintSymbol->primary,pstr.data());
|
|
|
|
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data());
|
|
|
|
if (error > WARN_INVALID_OPTION)
|
|
|
|
m_lastError=m_zintSymbol->errtxt;
|
|
|
|
|
2008-11-04 02:31:23 +13:00
|
|
|
if (m_zintSymbol->symbology == BARCODE_MAXICODE)
|
|
|
|
m_zintSymbol->height = 33;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::symbol()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_symbol;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setSymbol(int symbol)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
m_symbol=symbol;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
QString QZint::text()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_text;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setText(const QString & text)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
m_text=text;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
QString QZint::primaryMessage()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_primaryMessage;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setPrimaryMessage(const QString & primaryMessage)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
m_primaryMessage=primaryMessage;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::height()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
encode();
|
2008-11-19 06:10:54 +13:00
|
|
|
return (m_zintSymbol->height+(m_border!=NO_BORDER)?m_boderWidth*2:0)*(m_zintSymbol->symbology == BARCODE_MAXICODE?(maxi_width+1):1);
|
2008-09-18 05:36:08 +12:00
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setHeight(int height)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
m_height=height;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setWidth(int width)
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
m_width=width;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::width()
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
encode();
|
2008-10-09 22:56:54 +13:00
|
|
|
return (m_zintSymbol->width+(m_border==BOX)?m_boderWidth*2:0)*(m_zintSymbol->symbology == BARCODE_MAXICODE?(maxi_width+1):1);
|
2008-09-18 05:36:08 +12:00
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
QColor QZint::fgColor()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_fgColor;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setFgColor(const QColor & fgColor)
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
m_fgColor=fgColor;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
QColor QZint::bgColor()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_bgColor;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setBgColor(const QColor & bgColor)
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
m_bgColor=bgColor;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
QZint::BorderType QZint::borderType()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_border;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setBorderType(BorderType border)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
m_border=border;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::borderWidth()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_boderWidth;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setBorderWidth(int boderWidth)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-10-09 22:56:54 +13:00
|
|
|
if (boderWidth<1 || boderWidth>16)
|
|
|
|
boderWidth=1;
|
2008-07-19 02:48:31 +12:00
|
|
|
m_boderWidth=boderWidth;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::pdf417CodeWords()
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-09-18 05:36:08 +12:00
|
|
|
return m_pdf417CodeWords;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setPdf417CodeWords(int pdf417CodeWords)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-09-18 05:36:08 +12:00
|
|
|
m_pdf417CodeWords=pdf417CodeWords;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::securityLevel()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_securityLevel;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setSecurityLevel(int securityLevel)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
m_securityLevel=securityLevel;
|
|
|
|
}
|
|
|
|
|
2008-11-04 02:31:23 +13:00
|
|
|
int QZint::mode()
|
|
|
|
{
|
|
|
|
return m_securityLevel;
|
|
|
|
}
|
|
|
|
void QZint::setMode(int securityLevel)
|
|
|
|
{
|
|
|
|
m_securityLevel=securityLevel;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::msiExtraSymbology()
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-09-18 05:36:08 +12:00
|
|
|
return m_msiSymbologyNumber;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setMsiExtraSymbology(int msiSymbologyNumber)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-09-18 05:36:08 +12:00
|
|
|
m_msiSymbologyNumber=msiSymbologyNumber;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::code39ExtraSymbology()
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-09-18 05:36:08 +12:00
|
|
|
return m_code39SymbologyNumber;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setCode39ExtraSymbology(int m_code39SymbologyNumber)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-09-18 05:36:08 +12:00
|
|
|
m_code39SymbologyNumber=m_code39SymbologyNumber;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
int QZint::excode39ExtraSymbology()
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-09-18 05:36:08 +12:00
|
|
|
return m_excode39SymbologyNumber;
|
|
|
|
}
|
2008-09-19 02:43:54 +12:00
|
|
|
void QZint::setExcode39ExtraSymbology(int excode39SymbologyNumber)
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
m_excode39SymbologyNumber=excode39SymbologyNumber;
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|
2008-10-09 22:56:54 +13:00
|
|
|
void QZint::render(QPainter & painter, const QRectF & paintRect, AspectRatioMode mode)
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
|
|
|
encode();
|
2008-10-09 22:56:54 +13:00
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
if (m_lastError.length())
|
|
|
|
{
|
|
|
|
painter.drawText(paintRect,Qt::AlignCenter,m_lastError);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
painter.save();
|
|
|
|
painter.setClipRect(paintRect,Qt::IntersectClip);
|
|
|
|
qreal xtr=paintRect.x();
|
|
|
|
qreal ytr=paintRect.y();
|
|
|
|
|
2008-11-04 02:31:23 +13:00
|
|
|
int zrow_height=m_zintSymbol->height;
|
|
|
|
int zrows=0;
|
|
|
|
for (int i=0;i<m_zintSymbol->rows;i++)
|
|
|
|
{
|
|
|
|
zrow_height-=m_zintSymbol->row_height[i];
|
|
|
|
if (!m_zintSymbol->row_height[i])
|
|
|
|
zrows++;
|
|
|
|
}
|
|
|
|
if (zrows)
|
|
|
|
{
|
|
|
|
zrow_height/=zrows;
|
|
|
|
for (int i=0;i<m_zintSymbol->rows;i++)
|
|
|
|
if (!m_zintSymbol->row_height[i])
|
|
|
|
m_zintSymbol->row_height[i]=zrow_height;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_zintSymbol->height-=zrow_height;
|
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
|
2008-10-09 22:56:54 +13:00
|
|
|
qreal gwidth=m_zintSymbol->width;
|
|
|
|
qreal gheight=m_zintSymbol->height;
|
2008-07-19 02:48:31 +12:00
|
|
|
if (m_zintSymbol->symbology == BARCODE_MAXICODE)
|
|
|
|
{
|
2008-11-19 06:10:54 +13:00
|
|
|
gheight*=(maxi_width+1);
|
2008-10-09 22:56:54 +13:00
|
|
|
gwidth*=(maxi_width+1);
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|
2008-10-09 22:56:54 +13:00
|
|
|
qreal xsf=1;
|
|
|
|
qreal ysf=1;
|
|
|
|
|
|
|
|
gwidth+=((m_border==BOX)?m_boderWidth*2:0);
|
|
|
|
gheight+=((m_border!=NO_BORDER)?m_boderWidth*2:0);
|
2008-11-04 02:31:23 +13:00
|
|
|
gwidth+=m_zintSymbol->whitespace_width*2;
|
2008-07-19 02:48:31 +12:00
|
|
|
switch(mode)
|
|
|
|
{
|
|
|
|
case IgnoreAspectRatio:
|
|
|
|
xsf=(qreal)paintRect.width()/gwidth;
|
|
|
|
ysf=(qreal)paintRect.height()/gheight;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case KeepAspectRatio:
|
|
|
|
if (paintRect.width()-gwidth<paintRect.height()-gheight)
|
|
|
|
{
|
|
|
|
ysf=xsf=(qreal)paintRect.width()/gwidth;
|
|
|
|
ytr+=(qreal)(paintRect.height()-gheight*ysf)/2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ysf=xsf=(qreal)paintRect.height()/gheight;
|
|
|
|
xtr+=(qreal)(paintRect.width()-gwidth*xsf)/2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CenterBarCode:
|
|
|
|
xtr+=((qreal)paintRect.width()-gwidth*xsf)/2;
|
|
|
|
ytr+=((qreal)paintRect.height()-gheight*ysf)/2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
painter.setBackground(QBrush(m_bgColor));
|
|
|
|
painter.fillRect(paintRect,QBrush(m_bgColor));
|
|
|
|
painter.translate(xtr,ytr);
|
|
|
|
painter.scale(xsf,ysf);
|
|
|
|
|
|
|
|
QPen p;
|
|
|
|
p.setColor(m_fgColor);
|
|
|
|
p.setWidth(m_boderWidth);
|
|
|
|
painter.setPen(p);
|
|
|
|
|
|
|
|
QPainterPath pt;
|
|
|
|
switch(m_border)
|
|
|
|
{
|
|
|
|
case BOX:
|
|
|
|
painter.drawLine(m_boderWidth/2,m_boderWidth/2, gwidth-m_boderWidth/2, m_boderWidth/2);
|
2008-10-09 22:56:54 +13:00
|
|
|
painter.drawLine(gwidth-m_boderWidth/2, m_boderWidth/2, gwidth-m_boderWidth/2, gheight-m_boderWidth/2);
|
|
|
|
painter.drawLine(m_boderWidth/2, gheight-m_boderWidth/2, gwidth-m_boderWidth/2, gheight-m_boderWidth/2);
|
2008-07-19 02:48:31 +12:00
|
|
|
painter.drawLine(m_boderWidth/2, gheight-m_boderWidth/2, m_boderWidth/2,m_boderWidth/2);
|
2008-11-04 02:31:23 +13:00
|
|
|
painter.translate(m_boderWidth+m_zintSymbol->whitespace_width,m_boderWidth);
|
2008-07-19 02:48:31 +12:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BIND:
|
|
|
|
painter.drawLine(m_boderWidth/2,m_boderWidth/2,gwidth-m_boderWidth/2, m_boderWidth/2);
|
|
|
|
painter.drawLine(m_boderWidth/2,gheight-m_boderWidth/2,gwidth-m_boderWidth/2, gheight-m_boderWidth/2);
|
2008-11-04 02:31:23 +13:00
|
|
|
painter.translate(m_zintSymbol->whitespace_width,m_boderWidth);
|
2008-07-19 02:48:31 +12:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-11-04 02:31:23 +13:00
|
|
|
painter.translate(m_zintSymbol->whitespace_width,0);
|
2008-07-19 02:48:31 +12:00
|
|
|
break;;
|
|
|
|
}
|
|
|
|
|
|
|
|
p.setWidth(1);
|
|
|
|
painter.setPen(p);
|
|
|
|
|
|
|
|
if (m_zintSymbol->symbology == BARCODE_MAXICODE)
|
|
|
|
{
|
|
|
|
painter.save();
|
|
|
|
painter.setRenderHint(QPainter::Antialiasing);
|
2008-10-08 03:27:39 +13:00
|
|
|
for (int r=0;r<m_zintSymbol->rows;r++)
|
|
|
|
{
|
|
|
|
for (int c=0;c<m_zintSymbol->width;c++)
|
|
|
|
{
|
|
|
|
if (m_zintSymbol->encoded_data[r][c]=='1')
|
2008-07-19 02:48:31 +12:00
|
|
|
{
|
2008-10-09 22:56:54 +13:00
|
|
|
qreal col=(qreal)c*(maxi_width+1)+(r%2)*((maxi_width+1)/2);
|
2009-02-02 23:02:41 +13:00
|
|
|
qreal row=(qreal)r*(maxi_width+1)*0.868;
|
2008-07-19 02:48:31 +12:00
|
|
|
QPainterPath pt;
|
2008-10-09 22:56:54 +13:00
|
|
|
pt.moveTo(col+maxi_width/2, row);
|
|
|
|
pt.lineTo(col+maxi_width, row+maxi_diagonal/4);
|
|
|
|
pt.lineTo(col+maxi_width, row+(maxi_diagonal-maxi_diagonal/4));
|
|
|
|
pt.lineTo(col+maxi_width/2, row+maxi_diagonal);
|
2008-11-04 02:31:23 +13:00
|
|
|
pt.lineTo(col, row+(maxi_diagonal-maxi_diagonal/4));
|
|
|
|
pt.lineTo(col, row+maxi_diagonal/4);
|
2008-10-09 22:56:54 +13:00
|
|
|
pt.lineTo(col+maxi_width/2, row);
|
2008-07-19 02:48:31 +12:00
|
|
|
painter.fillPath(pt,QBrush(m_fgColor));
|
|
|
|
}
|
2008-10-08 03:27:39 +13:00
|
|
|
}
|
|
|
|
}
|
2008-10-09 22:56:54 +13:00
|
|
|
p.setWidth(maxi_width);
|
2008-07-19 02:48:31 +12:00
|
|
|
painter.setPen(p);
|
2008-10-09 22:56:54 +13:00
|
|
|
const qreal w=maxi_width+1;
|
2009-02-02 23:02:41 +13:00
|
|
|
painter.drawEllipse(QPointF(14.5*w,16.5*w*0.868),w,w);
|
|
|
|
painter.drawEllipse(QPointF(14.5*w,16.5*w*0.868),w+w*1.5,w+w*1.5);
|
|
|
|
painter.drawEllipse(QPointF(14.5*w,16.5*w*0.868),w+w*3,w+w*3);
|
2008-07-19 02:48:31 +12:00
|
|
|
painter.restore();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int y=0;
|
|
|
|
for (int row=0;row<m_zintSymbol->rows;row++)
|
|
|
|
{
|
|
|
|
for (int i=0;i<m_zintSymbol->width;i++)
|
|
|
|
if (m_zintSymbol->encoded_data[row][i]!='0')
|
|
|
|
{
|
|
|
|
int ed=m_zintSymbol->encoded_data[row][i];
|
|
|
|
int linewidth=0;
|
|
|
|
for (int j=i;j<m_zintSymbol->width;j++,linewidth++)
|
|
|
|
if (ed!=m_zintSymbol->encoded_data[row][j])
|
|
|
|
break;
|
|
|
|
QColor color;
|
|
|
|
switch(ed)
|
|
|
|
{
|
|
|
|
case 'R':
|
|
|
|
color=qRgb(0xff,0x00,0x00);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'G':
|
|
|
|
color=qRgb(0x00,0xff,0x00);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'B':
|
|
|
|
color=qRgb(0x00,0x00,0xff);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'C':
|
|
|
|
color=qRgb(0x00,0xff,0xff);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'M':
|
|
|
|
color=qRgb(0xff,0x00,0xff);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'Y':
|
|
|
|
color=qRgb(0xff,0xff,0x00);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
color=m_fgColor;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
painter.fillRect(i,y,linewidth,m_zintSymbol->row_height[row],QBrush(color));
|
|
|
|
}
|
|
|
|
y+=m_zintSymbol->row_height[row];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
painter.restore();
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
const QString & QZint::lastError()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_lastError;
|
|
|
|
}
|
|
|
|
|
2008-09-19 02:43:54 +12:00
|
|
|
bool QZint::hasErrors()
|
2008-09-18 05:36:08 +12:00
|
|
|
{
|
|
|
|
return m_lastError.length();
|
|
|
|
}
|
|
|
|
|
2008-07-19 02:48:31 +12:00
|
|
|
}
|
|
|
|
|