summaryrefslogtreecommitdiffstats
path: root/kbarcode/definitiondialog.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-29 00:55:34 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-29 00:55:34 +0000
commitc4189d200e71c7ef82e9a6e34935ad225154d658 (patch)
treef7f29a1159e0402472ff2ab22617a8113f66263c /kbarcode/definitiondialog.cpp
parent2f888b1578e65ec1bc514996eb509fcaf34462d6 (diff)
downloadkbarcode-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/definitiondialog.cpp')
-rw-r--r--kbarcode/definitiondialog.cpp184
1 files changed, 92 insertions, 92 deletions
diff --git a/kbarcode/definitiondialog.cpp b/kbarcode/definitiondialog.cpp
index d8f9484..253c9a2 100644
--- a/kbarcode/definitiondialog.cpp
+++ b/kbarcode/definitiondialog.cpp
@@ -23,33 +23,33 @@
#include <kcombobox.h>
#include <kpushbutton.h>
#include <krestrictedline.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qpainter.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqpainter.h>
// KDE includes
#include <klocale.h>
-LabelPreview::LabelPreview( QWidget* parent, const char* name )
- : QWidget( parent, name)
+LabelPreview::LabelPreview( TQWidget* tqparent, const char* name )
+ : TQWidget( tqparent, name)
{
// For old DIN A4 preview
PrinterSettings* ps = PrinterSettings::getInstance();
- setFixedSize( QSize( ((int)ps->pageWidth() + 20)/2, ((int)ps->pageHeight() + 20)/2 ) );
+ setFixedSize( TQSize( ((int)ps->pageWidth() + 20)/2, ((int)ps->pageHeight() + 20)/2 ) );
m_prv_enabled = true;
}
LabelPreview::~LabelPreview()
{ }
-void LabelPreview::paintEvent( QPaintEvent* )
+void LabelPreview::paintEvent( TQPaintEvent* )
{
- QPainter p( this );
- p.fillRect( 0, 0, width(), height(), QBrush( Qt::white ) );
- p.setPen( QPen( Qt::black ) );
+ TQPainter p( this );
+ p.fillRect( 0, 0, width(), height(), TQBrush( TQt::white ) );
+ p.setPen( TQPen( TQt::black ) );
p.translate( 10, 10 );
- p.fillRect( 0, 0, 210/2, 297/2, QBrush( Qt::gray ) );
+ p.fillRect( 0, 0, 210/2, 297/2, TQBrush( TQt::gray ) );
p.drawRect( 0, 0, 210/2, 297/2 );
if(!m_prv_enabled)
@@ -59,13 +59,13 @@ void LabelPreview::paintEvent( QPaintEvent* )
for( int v = 0; v < measure.numV(); v++ ) {
for( int h = 0; h < measure.numH(); h++ ) {
if( !v && !h )
- p.setPen( QPen( Qt::red ) );
+ p.setPen( TQPen( TQt::red ) );
else
- p.setPen( QPen( Qt::black ) );
+ p.setPen( TQPen( TQt::black ) );
p.fillRect( int(measure.gapLeftMM() + (measure.gapHMM() * h)) / 2,
int(measure.gapTopMM() + (measure.gapVMM() * v)) / 2 ,
- (int)measure.widthMM() / 2 , (int)measure.heightMM() / 2, QBrush( Qt::white ) );
+ (int)measure.widthMM() / 2 , (int)measure.heightMM() / 2, TQBrush( TQt::white ) );
p.drawRect( int(measure.gapLeftMM() + (measure.gapHMM() * h)) / 2,
int(measure.gapTopMM() + (measure.gapVMM() * v)) / 2,
@@ -75,60 +75,60 @@ void LabelPreview::paintEvent( QPaintEvent* )
}
/*****************************************/
-DefinitionDialog::DefinitionDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, fl )
+DefinitionDialog::DefinitionDialog( TQWidget* tqparent, const char* name, bool modal, WFlags fl )
+ : TQDialog( tqparent, name, modal, fl )
{
resize( 465, 345 );
setCaption( i18n( "Add Label Definition" ) );
- QHBoxLayout* layout = new QHBoxLayout( this, 6, 6 );
- DefinitionDialogLayout = new QVBoxLayout( 0, 11, 6, "DefinitionDialogLayout");
+ TQHBoxLayout* tqlayout = new TQHBoxLayout( this, 6, 6 );
+ DefinitionDialogLayout = new TQVBoxLayout( 0, 11, 6, "DefinitionDialogLayout");
- Layout17 = new QHBoxLayout( 0, 0, 6, "Layout17");
+ Layout17 = new TQHBoxLayout( 0, 0, 6, "Layout17");
- Layout13 = new QVBoxLayout( 0, 0, 6, "Layout13");
+ Layout13 = new TQVBoxLayout( 0, 0, 6, "Layout13");
- TextLabel1 = new QLabel( this, "TextLabel1" );
+ TextLabel1 = new TQLabel( this, "TextLabel1" );
TextLabel1->setText( i18n( "Producer:" ) );
Layout13->addWidget( TextLabel1 );
- TextLabel2 = new QLabel( this, "TextLabel2" );
+ TextLabel2 = new TQLabel( this, "TextLabel2" );
TextLabel2->setText( i18n( "Type:" ) );
Layout13->addWidget( TextLabel2 );
- TextLabel3 = new QLabel( this, "TextLabel3" );
- TextLabel3->setText( QString( i18n( "Width (in %1):" ) ).arg( Measurements::system() ) );
+ TextLabel3 = new TQLabel( this, "TextLabel3" );
+ TextLabel3->setText( TQString( i18n( "Width (in %1):" ) ).tqarg( Measurements::system() ) );
Layout13->addWidget( TextLabel3 );
- TextLabel4 = new QLabel( this, "TextLabel4" );
- TextLabel4->setText( QString( i18n( "Height (in %1):" ) ).arg( Measurements::system() ) );
+ TextLabel4 = new TQLabel( this, "TextLabel4" );
+ TextLabel4->setText( TQString( i18n( "Height (in %1):" ) ).tqarg( Measurements::system() ) );
Layout13->addWidget( TextLabel4 );
- TextLabel5 = new QLabel( this, "TextLabel5" );
+ TextLabel5 = new TQLabel( this, "TextLabel5" );
TextLabel5->setText( i18n( "Horizontal Gap:" ) );
Layout13->addWidget( TextLabel5 );
- TextLabel6 = new QLabel( this, "TextLabel6" );
+ TextLabel6 = new TQLabel( this, "TextLabel6" );
TextLabel6->setText( i18n( "Vertical Gap:" ) );
Layout13->addWidget( TextLabel6 );
- TextLabel7 = new QLabel( this, "TextLabel7" );
+ TextLabel7 = new TQLabel( this, "TextLabel7" );
TextLabel7->setText( i18n( "Top Gap:" ) );
Layout13->addWidget( TextLabel7 );
- TextLabel8 = new QLabel( this, "TextLabel8" );
+ TextLabel8 = new TQLabel( this, "TextLabel8" );
TextLabel8->setText( i18n( "Left Gap:" ) );
Layout13->addWidget( TextLabel8 );
- TextLabel9 = new QLabel( this, "TextLabel9" );
- TextLabel9->setText( i18n("Number Horizontal:") );
+ TextLabel9 = new TQLabel( this, "TextLabel9" );
+ TextLabel9->setText( i18n("NumberQt::Horizontal:") );
Layout13->addWidget( TextLabel9 );
- TextLabel10 = new QLabel( this, "TextLabel10" );
- TextLabel10->setText( i18n("Number Vertical:") );
+ TextLabel10 = new TQLabel( this, "TextLabel10" );
+ TextLabel10->setText( i18n("NumberQt::Vertical:") );
Layout13->addWidget( TextLabel10 );
Layout17->addLayout( Layout13 );
- Layout14 = new QVBoxLayout( 0, 0, 6, "Layout14");
+ Layout14 = new TQVBoxLayout( 0, 0, 6, "Layout14");
comboProducer = new KComboBox( FALSE, this, "comboProducer" );
comboProducer->setEditable( TRUE );
@@ -179,17 +179,17 @@ DefinitionDialog::DefinitionDialog( QWidget* parent, const char* name, bool mod
Layout14->addWidget( editNumV );
Layout17->addLayout( Layout14 );
- QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ TQSpacerItem* spacer = new TQSpacerItem( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
Layout17->addItem( spacer );
DefinitionDialogLayout->addLayout( Layout17 );
- QSpacerItem* spacer_2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ TQSpacerItem* spacer_2 = new TQSpacerItem( 0, 0, TQSizePolicy::Minimum, TQSizePolicy::Expanding );
DefinitionDialogLayout->addItem( spacer_2 );
- Layout16 = new QHBoxLayout( 0, 0, 6, "Layout16");
+ Layout16 = new TQHBoxLayout( 0, 0, 6, "Layout16");
buttonInfo = new KPushButton( i18n("More &Information"), this );
Layout16->addWidget( buttonInfo );
- QSpacerItem* spacer_3 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ TQSpacerItem* spacer_3 = new TQSpacerItem( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Minimum );
Layout16->addItem( spacer_3 );
buttonAdd = new KPushButton( this, "buttonAdd" );
@@ -202,39 +202,39 @@ DefinitionDialog::DefinitionDialog( QWidget* parent, const char* name, bool mod
DefinitionDialogLayout->addLayout( Layout16 );
preview = new LabelPreview( this );
- layout->addLayout( DefinitionDialogLayout );
- layout->addWidget( preview );
+ tqlayout->addLayout( DefinitionDialogLayout );
+ tqlayout->addWidget( preview );
- l = new QLabel( this );
+ l = new TQLabel( this );
setExtension( l );
- setOrientation( Vertical );
+ setOrientation(Qt::Vertical );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
- connect( buttonAdd, SIGNAL( clicked() ), this, SLOT( add() ) );
+ connect( buttonCancel, TQT_SIGNAL( clicked() ), this, TQT_SLOT( reject() ) );
+ connect( buttonAdd, TQT_SIGNAL( clicked() ), this, TQT_SLOT( add() ) );
- connect( editWidth, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) );
- connect( editHeight, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) );
- connect( editHGap, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) );
- connect( editVGap, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) );
- connect( editTGap, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) );
- connect( editLGap, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) );
- connect( editNumH, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) );
- connect( editNumV, SIGNAL( textChanged(const QString &) ), this, SLOT( updatePreview() ) );
+ connect( editWidth, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updatePreview() ) );
+ connect( editHeight, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updatePreview() ) );
+ connect( editHGap, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updatePreview() ) );
+ connect( editVGap, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updatePreview() ) );
+ connect( editTGap, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updatePreview() ) );
+ connect( editLGap, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updatePreview() ) );
+ connect( editNumH, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updatePreview() ) );
+ connect( editNumV, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updatePreview() ) );
- comboProducer->setInsertionPolicy( QComboBox::NoInsertion );
- comboType->setInsertionPolicy( QComboBox::NoInsertion );
+ comboProducer->setInsertionPolicy( TQComboBox::NoInsertion );
+ comboType->setInsertionPolicy( TQComboBox::NoInsertion );
comboProducer->clear();
- QStringList list = Definition::getProducers();
+ TQStringList list = Definition::getProducers();
comboProducer->insertStringList( list );
- types = new QStringList[list.count()];
+ types = new TQStringList[list.count()];
for( unsigned int i = 0; i < list.count(); i++ )
types[i] = Definition::getTypes( list[i] );
- connect( comboProducer, SIGNAL( textChanged(const QString &) ), this, SLOT( updateType() ) );
- connect( comboType, SIGNAL( textChanged(const QString &) ), this, SLOT( updateText() ) );
- connect( buttonInfo, SIGNAL( clicked() ), this, SLOT( toggleExtension() ) );
+ connect( comboProducer, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updateType() ) );
+ connect( comboType, TQT_SIGNAL( textChanged(const TQString &) ), this, TQT_SLOT( updateText() ) );
+ connect( buttonInfo, TQT_SIGNAL( clicked() ), this, TQT_SLOT( toggleExtension() ) );
drawGraphic();
updateType();
@@ -299,61 +299,61 @@ void DefinitionDialog::updatePreview()
{
Measurements m = getCurrentMeasure();
- editHeight->setPaletteForegroundColor( Qt::black );
- editWidth->setPaletteForegroundColor( Qt::black );
- editVGap->setPaletteForegroundColor( Qt::black );
- editHGap->setPaletteForegroundColor( Qt::black );
- editTGap->setPaletteForegroundColor( Qt::black );
- editLGap->setPaletteForegroundColor( Qt::black );
- editNumH->setPaletteForegroundColor( Qt::black );
- editNumV->setPaletteForegroundColor( Qt::black );
+ editHeight->setPaletteForegroundColor( TQt::black );
+ editWidth->setPaletteForegroundColor( TQt::black );
+ editVGap->setPaletteForegroundColor( TQt::black );
+ editHGap->setPaletteForegroundColor( TQt::black );
+ editTGap->setPaletteForegroundColor( TQt::black );
+ editLGap->setPaletteForegroundColor( TQt::black );
+ editNumH->setPaletteForegroundColor( TQt::black );
+ editNumV->setPaletteForegroundColor( TQt::black );
// Mark errors in Red
if( m.heightMM() > PrinterSettings::getInstance()->pageHeight() )
- editHeight->setPaletteForegroundColor( Qt::red );
+ editHeight->setPaletteForegroundColor( TQt::red );
if( m.widthMM() > PrinterSettings::getInstance()->pageWidth() )
- editWidth->setPaletteForegroundColor( Qt::red );
+ editWidth->setPaletteForegroundColor( TQt::red );
if( m.gapVMM() < m.heightMM() )
- editVGap->setPaletteForegroundColor( Qt::red );
+ editVGap->setPaletteForegroundColor( TQt::red );
if( m.gapHMM() < m.widthMM() )
- editHGap->setPaletteForegroundColor( Qt::red );
+ editHGap->setPaletteForegroundColor( TQt::red );
if( m.gapTopMM() > PrinterSettings::getInstance()->pageHeight() - m.heightMM() )
- editTGap->setPaletteForegroundColor( Qt::red );
+ editTGap->setPaletteForegroundColor( TQt::red );
if( m.gapLeftMM() > PrinterSettings::getInstance()->pageWidth() - m.widthMM() )
- editLGap->setPaletteForegroundColor( Qt::red );
+ editLGap->setPaletteForegroundColor( TQt::red );
if( m.gapLeftMM() + m.numH() * m.gapHMM() > PrinterSettings::getInstance()->pageWidth() )
- editNumH->setPaletteForegroundColor( Qt::red );
+ editNumH->setPaletteForegroundColor( TQt::red );
if( m.gapTopMM() + m.numV() * m.gapVMM() > PrinterSettings::getInstance()->pageHeight() )
- editNumV->setPaletteForegroundColor( Qt::red );
+ editNumV->setPaletteForegroundColor( TQt::red );
- preview->setRect( QRect( (int)m.gapLeftMM(), (int)m.gapTopMM(), (int)m.widthMM(), (int)m.heightMM() ) );
+ preview->setRect( TQRect( (int)m.gapLeftMM(), (int)m.gapTopMM(), (int)m.widthMM(), (int)m.heightMM() ) );
preview->setMeasurements( m );
- preview->repaint();
+ preview->tqrepaint();
}
void DefinitionDialog::drawGraphic()
{
- QWMatrix wm;
+ TQWMatrix wm;
wm.rotate( 90 );
- QPixmap pic( 450, 330 );
- pic.fill( Qt::gray );
+ TQPixmap pic( 450, 330 );
+ pic.fill( TQt::gray );
- QPainter p( &pic );
- p.setPen( Qt::black );
+ TQPainter p( &pic );
+ p.setPen( TQt::black );
- p.fillRect( 60, 60, 450, 330, QColor( 255, 254, 217 ) );
+ p.fillRect( 60, 60, 450, 330, TQColor( 255, 254, 217 ) );
p.drawRect( 60, 60, 450, 330 );
- p.setBrush( Qt::white );
+ p.setBrush( TQt::white );
- p.setPen( Qt::DotLine );
+ p.setPen( TQt::DotLine );
p.drawRoundRect( 90, 90, 150, 90 );
p.drawRoundRect( 270, 90, 150, 90 );
@@ -361,14 +361,14 @@ void DefinitionDialog::drawGraphic()
p.drawRoundRect( 270, 210, 150, 90 );
// Draw width
- p.setPen( QPen( Qt::red, 2 ) );
+ p.setPen( TQPen( TQt::red, 2 ) );
p.drawLine( 90, 150, 240, 150 );
// Draw numh
p.drawLine( 90, 270, 450, 270 );
// Draw Gap Top
- p.setPen( QPen( Qt::red, 2, Qt::DotLine ) );
+ p.setPen( TQPen( TQt::red, 2, TQt::DotLine ) );
p.drawLine( 0, 60, 90, 60 );
p.drawLine( 0, 90, 90, 90 );
@@ -376,7 +376,7 @@ void DefinitionDialog::drawGraphic()
p.drawLine( 0, 210, 90, 210 );
// Draw height
- p.setPen( QPen( Qt::green, 2 ) );
+ p.setPen( TQPen( TQt::green, 2 ) );
p.drawLine( 150, 90, 150, 180 );
@@ -384,7 +384,7 @@ void DefinitionDialog::drawGraphic()
p.drawLine( 330, 90, 330, 330 );
// Draw Gap Left
- p.setPen( QPen( Qt::green, 2, Qt::DotLine ) );
+ p.setPen( TQPen( TQt::green, 2, TQt::DotLine ) );
p.drawLine( 60, 0, 60, 90 );
p.drawLine( 90, 0, 90, 90 );
@@ -392,12 +392,12 @@ void DefinitionDialog::drawGraphic()
p.drawLine( 270, 0, 270, 90 );
// draw Texts:
- p.setPen( Qt::black );
+ p.setPen( TQt::black );
p.drawText( 100, 140, i18n("Width") );
p.drawText( 160, 120, i18n("Height") );
p.drawText( 100, 260, i18n("Number of horizontal Labels") );
- QPixmap* pix = LabelUtils::drawString( i18n("Number of vertical Labels") );
+ TQPixmap* pix = LabelUtils::drawString( i18n("Number of vertical Labels") );
p.drawPixmap( 340, 110, pix->xForm( wm ) );
delete pix;