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/gnubarcode.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/gnubarcode.cpp')
-rw-r--r-- | kbarcode/gnubarcode.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/kbarcode/gnubarcode.cpp b/kbarcode/gnubarcode.cpp index 6f69644..d009802 100644 --- a/kbarcode/gnubarcode.cpp +++ b/kbarcode/gnubarcode.cpp @@ -24,9 +24,9 @@ #include <string.h> #include <ctype.h> -#include <qfont.h> -#include <qpainter.h> -#include <qpaintdevicemetrics.h> +#include <tqfont.h> +#include <tqpainter.h> +#include <tqpaintdevicemetrics.h> #include <klocale.h> @@ -38,7 +38,7 @@ GnuBarcode::GnuBarcode() : BarkodeEngine() { m_item = NULL; - m_size = QSize( 0, 0 ); + m_size = TQSize( 0, 0 ); m_scalex = 1.0; m_scaley = 1.0; @@ -52,9 +52,9 @@ GnuBarcode::~GnuBarcode() Barcode_Delete( m_item ); } -void GnuBarcode::update( const QPaintDevice* device ) +void GnuBarcode::update( const TQPaintDevice* device ) { - QString val = barkode->parsedValue(); + TQString val = barkode->parsedValue(); m_valid = false; if( m_item ) @@ -91,9 +91,9 @@ void GnuBarcode::update( const QPaintDevice* device ) delete [] value; - QPaintDeviceMetrics metrics( device ); - m_scalex = (double)metrics.logicalDpiX() / (double)QPaintDevice::x11AppDpiX(); - m_scaley = (double)metrics.logicalDpiY() / (double)QPaintDevice::x11AppDpiY(); + TQPaintDeviceMetrics metrics( device ); + m_scalex = (double)metrics.logicalDpiX() / (double)TQPaintDevice::x11AppDpiX(); + m_scaley = (double)metrics.logicalDpiY() / (double)TQPaintDevice::x11AppDpiY(); // 72.0 is the postscript resolution generated by GNU barcode m_scale_ps_x = (double)metrics.logicalDpiX() / 72.0; @@ -107,15 +107,15 @@ void GnuBarcode::update( const QPaintDevice* device ) m_valid = true; } -const QSize GnuBarcode::size() const +const TQSize GnuBarcode::size() const { if( m_size.isNull() ) - return QSize( 100, 80 ); + return TQSize( 100, 80 ); else return m_size; } -void GnuBarcode::drawBarcode( QPainter & painter, int x, int y ) +void GnuBarcode::drawBarcode( TQPainter & painter, int x, int y ) { int dx = x + barkode->quietZone(); int dy = y + barkode->quietZone(); @@ -134,7 +134,7 @@ void GnuBarcode::drawBarcode( QPainter & painter, int x, int y ) drawBars( &painter, (int)(dx/m_scalex), (int)(dy/m_scaley) ); // Only scale for the bars, text should be scaled - // correctly by Qt on Qt >= 3.3.2 + // correctly by TQt on TQt >= 3.3.2 painter.restore(); // draw the text @@ -165,7 +165,7 @@ void GnuBarcode::setupSize() m_size.setHeight( (int)(m_item->height * m_scaley) ); } -int GnuBarcode::drawBars( QPainter* painter, int x, int y ) +int GnuBarcode::drawBars( TQPainter* painter, int x, int y ) { #if 0 int height = 0; // height of the bar to draw @@ -267,7 +267,7 @@ int GnuBarcode::drawBars( QPainter* painter, int x, int y ) return xpos; } -int GnuBarcode::drawText( QPainter* painter, int x, int y ) +int GnuBarcode::drawText( TQPainter* painter, int x, int y ) { #if 0 unsigned int infosz = strlen( m_item->textinfo ); @@ -281,7 +281,7 @@ int GnuBarcode::drawText( QPainter* painter, int x, int y ) char printer; char *temp_info = new char[infosz+1]; - painter.setFont( QFont( "Helvetica", 12 ) ); + painter.setFont( TQFont( "Helvetica", 12 ) ); while(i < infosz) { for(j = 0; m_item->textinfo[i + j + 1] != ' ' && @@ -298,7 +298,7 @@ int GnuBarcode::drawText( QPainter* painter, int x, int y ) prev_x = xpos; painter.drawText( x + ((xpos-correction) * m_scalex), y + ((m_bar_height + (unsigned int)(barkode->fontsize()/ 2) + FONT_SPACE) * m_scaley), - QChar( printer ) ); + TQChar( printer ) ); } delete [] temp_info; #endif @@ -336,8 +336,8 @@ int GnuBarcode::drawText( QPainter* painter, int x, int y ) if( painter ) { - painter->setFont( QFont( "Helvetica", m_font_size ) ); - painter->drawText( x + (int)(f1 * m_scalex * barkode->scaling() ), y0, QChar( c ) ); + painter->setFont( TQFont( "Helvetica", m_font_size ) ); + painter->drawText( x + (int)(f1 * m_scalex * barkode->scaling() ), y0, TQChar( c ) ); } } |