diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-29 00:55:34 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-29 00:55:34 +0000 |
commit | c4189d200e71c7ef82e9a6e34935ad225154d658 (patch) | |
tree | f7f29a1159e0402472ff2ab22617a8113f66263c /kbarcode/label.cpp | |
parent | 2f888b1578e65ec1bc514996eb509fcaf34462d6 (diff) | |
download | kbarcode-c4189d200e71c7ef82e9a6e34935ad225154d658.tar.gz kbarcode-c4189d200e71c7ef82e9a6e34935ad225154d658.zip |
TQt4 port kbarcode
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbarcode@1233956 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kbarcode/label.cpp')
-rw-r--r-- | kbarcode/label.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/kbarcode/label.cpp b/kbarcode/label.cpp index 2537fcb..f565c77 100644 --- a/kbarcode/label.cpp +++ b/kbarcode/label.cpp @@ -27,21 +27,21 @@ #include "imageitem.h" #include "textitem.h" -// Qt includes -#include <qimage.h> -#include <qiodevice.h> -#include <qpaintdevicemetrics.h> -#include <qpainter.h> -#include <qpen.h> -#include <qsqlcursor.h> -#include <qxml.h> +// TQt includes +#include <tqimage.h> +#include <tqiodevice.h> +#include <tqpaintdevicemetrics.h> +#include <tqpainter.h> +#include <tqpen.h> +#include <tqsqlcursor.h> +#include <tqxml.h> // KDE includes #include <kapplication.h> #include <klocale.h> #include <kprinter.h> -Label::Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevice* _printer, QString customer_id, QString _article_no, QString _group ) +Label::Label( Definition* _def, TQIODevice* device, TQString labelname, TQPaintDevice* _printer, TQString customer_id, TQString _article_no, TQString _group ) : TokenProvider( _printer ) { m_sequence = false; @@ -50,20 +50,20 @@ Label::Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevi setCustomerNo( customer_id ); setArticleNo( _article_no ); setGroup( _group ); - setLabelName( labelname.right( labelname.length() - labelname.findRev( "/" ) - 1 ) ); + setLabelName( labelname.right( labelname.length() - labelname.tqfindRev( "/" ) - 1 ) ); d = _def; load( device ); } -Label::Label( Definition* _def, QIODevice* device, QString labelname, QPaintDevice* _printer ) +Label::Label( Definition* _def, TQIODevice* device, TQString labelname, TQPaintDevice* _printer ) : TokenProvider( _printer ) { m_sequence = false; m_printer = _printer; - setLabelName( labelname.right( labelname.length() - labelname.findRev( "/" ) - 1 ) ); + setLabelName( labelname.right( labelname.length() - labelname.tqfindRev( "/" ) - 1 ) ); d = _def; @@ -74,7 +74,7 @@ Label::~Label() { } -void Label::epcl( QTextStream* stream ) +void Label::epcl( TQTextStream* stream ) { *stream << EPCLUtils::header(); @@ -86,7 +86,7 @@ void Label::epcl( QTextStream* stream ) *stream << EPCLUtils::footer(); } -void Label::ipl( QTextStream* stream ) +void Label::ipl( TQTextStream* stream ) { IPLUtils utils; *stream << utils.header(); @@ -100,7 +100,7 @@ void Label::ipl( QTextStream* stream ) } -void Label::zpl( QTextStream* stream ) +void Label::zpl( TQTextStream* stream ) { *stream << ZPLUtils::header(); @@ -147,10 +147,10 @@ void Label::InitBarcodes() updateDone(); } -void Label::draw( QPainter* painter, int x, int y ) +void Label::draw( TQPainter* painter, int x, int y ) { - QSize label( (int)d->getMeasurements().width( painter->device() ), - (int)d->getMeasurements().height( painter->device() ) ); + TQSize label( (int)d->getMeasurements().width( TQT_TQPAINTDEVICE(painter->device()) ), + (int)d->getMeasurements().height( TQT_TQPAINTDEVICE(painter->device()) ) ); InitBarcodes(); @@ -161,7 +161,7 @@ void Label::draw( QPainter* painter, int x, int y ) // add x and y to clip coordinates // as clip has its top left corner // at (0,0) - QRect clip( item->boundingRect() ); + TQRect clip( item->boundingRect() ); if( x + clip.x() < x ) clip.setX( 0 ); @@ -176,7 +176,7 @@ void Label::draw( QPainter* painter, int x, int y ) painter->save(); painter->translate( x,y ); - painter->setClipRect( clip, QPainter::CoordPainter ); + painter->setClipRect( clip, TQPainter::CoordPainter ); item->draw( painter ); painter->restore(); } @@ -187,10 +187,10 @@ void Label::setBarcodeValue( Barkode* barcode ) // use the same i18n() for static as in BarcodeSettingsDlg if( barcode->databaseMode().lower() != "static" && barcode->databaseMode().lower() != i18n("Static") ) { - QString encoding_type = getTypeFromCaption( barcode->databaseMode() ); - QString mode = getModeFromCaption( barcode->databaseMode() ); + TQString encoding_type = getTypeFromCaption( barcode->databaseMode() ); + TQString mode = getModeFromCaption( barcode->databaseMode() ); - QSqlQuery query( "select barcode_no, encoding_type from " TABLE_BASIC + TQSqlQuery query( "select barcode_no, encoding_type from " TABLE_BASIC " where article_no = '" + articleNo() + "'" ); while ( query.next() ) { @@ -200,7 +200,7 @@ void Label::setBarcodeValue( Barkode* barcode ) if( mode.lower() != "main" ) { - QSqlQuery query1( "select barcode_no from " TABLE_CUSTOMER_TEXT " where customer_no ='"+ mode + + TQSqlQuery query1( "select barcode_no from " TABLE_CUSTOMER_TEXT " where customer_no ='"+ mode + "' and article_no='" + articleNo() + "'" ); while ( query1.next() ) { @@ -214,18 +214,18 @@ void Label::setBarcodeValue( Barkode* barcode ) } } -void Label::load( QIODevice* device ) +void Label::load( TQIODevice* device ) { if( !device ) return; if( !device->isOpen() ) device->open( IO_ReadOnly ); - QDomDocument doc( "KBarcodeLabel" ); + TQDomDocument doc( "KBarcodeLabel" ); doc.setContent( device ); bool kbarcode18; - QString description; + TQString description; Definition* definition = NULL; readXMLHeader( &doc, description, kbarcode18, &definition ); delete definition; @@ -247,16 +247,16 @@ void Label::load( QIODevice* device ) device->close(); } -void Label::getXLabel( double x, double y, double width, double height, QPainter* painter, int mode, QString value ) +void Label::getXLabel( double x, double y, double width, double height, TQPainter* painter, int mode, TQString value ) { painter->save(); if( mode == LABEL_X ) { - painter->setPen( QPen( Qt::black, 5) ); + painter->setPen( TQPen( TQt::black, 5) ); painter->drawLine( (int)x, (int)y, int(x+width), int(y+height) ); painter->drawLine( (int)x, int(y+height), int(x+width), (int)y ); } else if( mode == ARTICLE_GROUP_NO ) { - painter->setPen( QPen( QPen::black, 1 ) ); - QFont f( "helvetica", 15 ); + painter->setPen( TQPen( TQPen::black, 1 ) ); + TQFont f( "helvetica", 15 ); int w = 0; do { f.setPointSize( f.pointSize() - 1 ); @@ -281,7 +281,7 @@ int Label::getId() const bool Label::drawThisItem( const DocumentItem* item ) { - QString script = item->visibilityScript(); + TQString script = item->visibilityScript(); // make things go faster if the script is just "true" if( script.isEmpty() || script == "true" ) |