summaryrefslogtreecommitdiffstats
path: root/kbarcode/labelutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kbarcode/labelutils.cpp')
-rw-r--r--kbarcode/labelutils.cpp90
1 files changed, 45 insertions, 45 deletions
diff --git a/kbarcode/labelutils.cpp b/kbarcode/labelutils.cpp
index 7325f3e..515f54b 100644
--- a/kbarcode/labelutils.cpp
+++ b/kbarcode/labelutils.cpp
@@ -18,12 +18,12 @@
#include "labelutils.h"
#include "dsrichtext.h"
-// Qt includes
-#include <qbitmap.h>
-#include <qimage.h>
-#include <qpaintdevicemetrics.h>
-#include <qpainter.h>
-#include <qsimplerichtext.h>
+// TQt includes
+#include <tqbitmap.h>
+#include <tqimage.h>
+#include <tqpaintdevicemetrics.h>
+#include <tqpainter.h>
+#include <tqsimplerichtext.h>
// KDE includes
#include <kapplication.h>
@@ -42,16 +42,16 @@ LabelUtils::LabelUtils()
LabelUtils::~LabelUtils()
{ }
-double LabelUtils::pixelToMm( double pixel, const QPaintDevice* device, int mode )
+double LabelUtils::pixelToMm( double pixel, const TQPaintDevice* device, int mode )
{
- QPaintDeviceMetrics pdm( device ? device : KApplication::desktop() );
+ TQPaintDeviceMetrics pdm( device ? device : TQT_TQPAINTDEVICE(KApplication::desktop()) );
if( mode == DpiX )
return (pixel * CONVERSION_FACTOR) / (double)pdm.logicalDpiX();
else
return (pixel * CONVERSION_FACTOR) / (double)pdm.logicalDpiY();
}
-double LabelUtils::mmToPixel( double mm, const QPaintDevice* device, int mode )
+double LabelUtils::mmToPixel( double mm, const TQPaintDevice* device, int mode )
{
if( !mm )
return 0;
@@ -59,7 +59,7 @@ double LabelUtils::mmToPixel( double mm, const QPaintDevice* device, int mode )
// We don't get valid metrics from the printer - and we want a better resolution
// anyway (it's the PS driver that takes care of the printer resolution).
- QPaintDeviceMetrics pdm( device ? device : KApplication::desktop() );
+ TQPaintDeviceMetrics pdm( device ? device : TQT_TQPAINTDEVICE(KApplication::desktop()) );
// qDebug("DpiX=%i", pdm.logicalDpiX());
// qDebug("DpiY=%i", pdm.logicalDpiY());
@@ -69,49 +69,49 @@ double LabelUtils::mmToPixel( double mm, const QPaintDevice* device, int mode )
return (mm / CONVERSION_FACTOR) * (double)pdm.logicalDpiY();
}
-double LabelUtils::pixelToPixelX( double unit, const QPaintDevice* src, const QPaintDevice* dest )
+double LabelUtils::pixelToPixelX( double unit, const TQPaintDevice* src, const TQPaintDevice* dest )
{
- QPaintDeviceMetrics p1( src );
- QPaintDeviceMetrics p2( dest );
+ TQPaintDeviceMetrics p1( src );
+ TQPaintDeviceMetrics p2( dest );
return ( unit * (double)p2.logicalDpiX() ) / (double)p1.logicalDpiX();
}
-double LabelUtils::pixelToPixelY( double unit, const QPaintDevice* src, const QPaintDevice* dest )
+double LabelUtils::pixelToPixelY( double unit, const TQPaintDevice* src, const TQPaintDevice* dest )
{
- QPaintDeviceMetrics p1( src );
- QPaintDeviceMetrics p2( dest );
+ TQPaintDeviceMetrics p1( src );
+ TQPaintDeviceMetrics p2( dest );
//return pixelToPixelX( unit, src, dest );
return ( unit * (double)p2.logicalDpiY() ) / (double)p1.logicalDpiY();
}
-const QString LabelUtils::getTypeFromCaption( const QString & cap )
+const TQString LabelUtils::getTypeFromCaption( const TQString & cap )
{
// TODO: remove this function
- QString search = cap.right( cap.length() - cap.find(":") - 1 ).lower().stripWhiteSpace();
+ TQString search = cap.right( cap.length() - cap.tqfind(":") - 1 ).lower().stripWhiteSpace();
return search;
}
-const QString LabelUtils::getModeFromCaption( const QString & cap )
+const TQString LabelUtils::getModeFromCaption( const TQString & cap )
{
- return cap.left( cap.find(":") ).lower().stripWhiteSpace();
+ return cap.left( cap.tqfind(":") ).lower().stripWhiteSpace();
}
-QSize LabelUtils::stringSize( const QString & t )
+TQSize LabelUtils::stringSize( const TQString & t )
{
- QSimpleRichText srt( t, KApplication::font() );
- QSize s;
+ TQSimpleRichText srt( t, KApplication::font() );
+ TQSize s;
s.setWidth( srt.widthUsed() );
s.setHeight( srt.height() );
return s;
}
-void LabelUtils::renderString( QPainter* painter, const QString & t, const QRect & rect, double scalex, double scaley )
+void LabelUtils::renderString( TQPainter* painter, const TQString & t, const TQRect & rect, double scalex, double scaley )
{
// DSRichText cannot calculate the width on its own
- QSimpleRichText srt( t, KApplication::font() );
+ TQSimpleRichText srt( t, KApplication::font() );
int width = (rect.width() > 0) ? rect.width() : srt.widthUsed();
int height = (rect.height() > 0) ? rect.height() : srt.height();
@@ -124,40 +124,40 @@ void LabelUtils::renderString( QPainter* painter, const QString & t, const QRect
r.draw( painter );
}
-QPixmap* LabelUtils::drawString( const QString & t, int w, int h, double rot )
+TQPixmap* LabelUtils::drawString( const TQString & t, int w, int h, double rot )
{
- QSimpleRichText srt( t, KApplication::font() );
+ TQSimpleRichText srt( t, KApplication::font() );
int width = (w > 0) ? w : srt.widthUsed();
int height = (h > 0) ? h : srt.height();
srt.setWidth( width );
- QPixmap* pix;
- QPainter painter;
+ TQPixmap* pix;
+ TQPainter painter;
if( rot == 0.0 ) {
- QBitmap bm( width, height );
- bm.fill( Qt::color0 ); //transparent
+ TQBitmap bm( width, height );
+ bm.fill( TQt::color0 ); //transparent
painter.begin( &bm );
painter.save();
- painter.setPen( Qt::color1 );
- QColorGroup cg;
- cg.setColor( QColorGroup::Foreground, Qt::color1 );
- cg.setColor( QColorGroup::Text, Qt::color1 );
- cg.setColor( QColorGroup::Base, Qt::color0 );
+ painter.setPen( TQt::color1 );
+ TQColorGroup cg;
+ cg.setColor( TQColorGroup::Foreground, TQt::color1 );
+ cg.setColor( TQColorGroup::Text, TQt::color1 );
+ cg.setColor( TQColorGroup::Base, TQt::color0 );
srt.draw( &painter, 0, 0, bm.rect(), cg );
painter.restore();
painter.end();
- pix = new QPixmap( width, height );
- pix->fill( Qt::white );
+ pix = new TQPixmap( width, height );
+ pix->fill( TQt::white );
pix->setMask( bm );
if( !pix->isNull() ) {
painter.begin( pix );
- painter.setPen( Qt::black );
- QColorGroup cg;
+ painter.setPen( TQt::black );
+ TQColorGroup cg;
srt.draw( &painter, 0, 0, pix->rect(), cg );
painter.end();
}
@@ -165,14 +165,14 @@ QPixmap* LabelUtils::drawString( const QString & t, int w, int h, double rot )
int w2 = (w > 0) ? w : srt.widthUsed();
int h2 = (h > 0) ? h : srt.height();
- QWMatrix wm;
+ TQWMatrix wm;
wm.rotate( rot );
- QSize s = LabelUtils::stringSize( t );
- QPixmap* tmp = LabelUtils::drawString( t, s.width(), s.height() );
+ TQSize s = LabelUtils::stringSize( t );
+ TQPixmap* tmp = LabelUtils::drawString( t, s.width(), s.height() );
- QPixmap* p = new QPixmap( w2, h2 );
- p->fill( Qt::white );
+ TQPixmap* p = new TQPixmap( w2, h2 );
+ p->fill( TQt::white );
painter.begin( p );
painter.drawPixmap( 0, 0, tmp->xForm( wm ) );
painter.end();