diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /karbon/tools/vpatterntool.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'karbon/tools/vpatterntool.cc')
-rw-r--r-- | karbon/tools/vpatterntool.cc | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/karbon/tools/vpatterntool.cc b/karbon/tools/vpatterntool.cc index 0143d0bc..01dfc460 100644 --- a/karbon/tools/vpatterntool.cc +++ b/karbon/tools/vpatterntool.cc @@ -19,13 +19,13 @@ #include "vpatterntool.h" -#include <qtoolbutton.h> -#include <qframe.h> -#include <qhbuttongroup.h> -#include <qlayout.h> -#include <qfileinfo.h> -#include <qlabel.h> -#include <qcursor.h> +#include <tqtoolbutton.h> +#include <tqframe.h> +#include <tqhbuttongroup.h> +#include <tqlayout.h> +#include <tqfileinfo.h> +#include <tqlabel.h> +#include <tqcursor.h> #include <kiconloader.h> #include <koIconChooser.h> @@ -45,15 +45,15 @@ #include <commands/vstrokecmd.h> #include <widgets/vstrokefillpreview.h> -VPatternWidget::VPatternWidget( QPtrList<KoIconItem>* patterns, VTool*, QWidget* parent ) - : KDialogBase( parent, "", true, i18n( "Choose Pattern" ), Ok | Cancel ), m_pattern( 0 ) +VPatternWidget::VPatternWidget( TQPtrList<KoIconItem>* patterns, VTool*, TQWidget* tqparent ) + : KDialogBase( tqparent, "", true, i18n( "Choose Pattern" ), Ok | Cancel ), m_pattern( 0 ) { - QWidget *base = new QWidget( this ); - QVBoxLayout* layout = new QVBoxLayout( base ); - layout->addWidget( m_patternChooser = new KoIconChooser( QSize( 32, 32 ), base ) ); - layout->addWidget( m_buttonGroup = new QHButtonGroup( base ) ); - m_buttonGroup->insert( m_importPatternButton = new QToolButton( m_buttonGroup ) ); - m_buttonGroup->insert( m_deletePatternButton = new QToolButton( m_buttonGroup ) ); + TQWidget *base = new TQWidget( this ); + TQVBoxLayout* tqlayout = new TQVBoxLayout( base ); + tqlayout->addWidget( m_patternChooser = new KoIconChooser( TQSize( 32, 32 ), base ) ); + tqlayout->addWidget( m_buttonGroup = new TQHButtonGroup( base ) ); + m_buttonGroup->insert( m_importPatternButton = new TQToolButton( m_buttonGroup ) ); + m_buttonGroup->insert( m_deletePatternButton = new TQToolButton( m_buttonGroup ) ); m_patternChooser->setFixedSize( 180, 120 ); m_importPatternButton->setIconSet( SmallIconSet( "14_layer_newlayer" ) ); m_importPatternButton->setTextLabel( i18n( "Import" ) ); @@ -65,10 +65,10 @@ VPatternWidget::VPatternWidget( QPtrList<KoIconItem>* patterns, VTool*, QWidget* m_deletePatternButton->setEnabled( false ); //setFrameStyle( Box | Sunken ); - layout->setMargin( 3 ); + tqlayout->setMargin( 3 ); - connect( m_buttonGroup, SIGNAL( clicked( int ) ), this, SLOT( slotButtonClicked( int ) ) ); - connect( m_patternChooser, SIGNAL( selected( KoIconItem* ) ), this, SLOT( patternSelected( KoIconItem* ) ) ); + connect( m_buttonGroup, TQT_SIGNAL( clicked( int ) ), this, TQT_SLOT( slotButtonClicked( int ) ) ); + connect( m_patternChooser, TQT_SIGNAL( selected( KoIconItem* ) ), this, TQT_SLOT( patternSelected( KoIconItem* ) ) ); KoIconItem* item; for( item = patterns->first(); item; item = patterns->next() ) @@ -89,7 +89,7 @@ VPattern* VPatternWidget::selectedPattern() void VPatternWidget::importPattern() { - VPattern* pattern = KarbonFactory::rServer()->addPattern( KFileDialog::getOpenFileName( QString::null, + VPattern* pattern = KarbonFactory::rServer()->addPattern( KFileDialog::getOpenFileName( TQString(), "*.jpg *.gif *.png *.tif *.xpm *.bmp", this, i18n( "Choose Pattern to Add" ) ) ); if( pattern ) m_patternChooser->addItem( pattern ); @@ -117,13 +117,13 @@ void VPatternWidget::slotButtonClicked( int id ) void VPatternWidget::patternSelected( KoIconItem* item ) { m_pattern = (VPattern*)item; - m_deletePatternButton->setEnabled( QFileInfo( m_pattern->tilename() ).isWritable() ); + m_deletePatternButton->setEnabled( TQFileInfo( m_pattern->tilename() ).isWritable() ); } // VPatternWidget::patternSelected VPatternTool::VPatternTool( KarbonView *view ) : VTool( view, "tool_pattern" ), m_state( normal ), m_handleSize( 3 ), m_active( false ) { - QPtrList<KoIconItem> patterns = KarbonFactory::rServer()->patterns(); + TQPtrList<KoIconItem> patterns = KarbonFactory::rServer()->patterns(); m_optionsWidget = new VPatternWidget( &patterns, this ); registerTool( this ); } // VPatternTool::VPatternTool @@ -140,7 +140,7 @@ VPatternTool::activate() m_state = normal; VTool::activate(); view()->statusMessage()->setText( i18n( "Pattern" ) ); - view()->setCursor( QCursor( Qt::crossCursor ) ); + view()->setCursor( TQCursor( TQt::crossCursor ) ); if( view() ) { @@ -150,10 +150,10 @@ VPatternTool::activate() VStrokeFillPreview* preview = view()->strokeFillPreview(); if( preview ) { - connect( preview, SIGNAL( fillSelected() ), this, SLOT( targetChanged() ) ); - connect( preview, SIGNAL( strokeSelected() ), this, SLOT( targetChanged() ) ); + connect( preview, TQT_SIGNAL( fillSelected() ), this, TQT_SLOT( targetChanged() ) ); + connect( preview, TQT_SIGNAL( strokeSelected() ), this, TQT_SLOT( targetChanged() ) ); } - view()->repaintAll( view()->part()->document().selection()->boundingBox() ); + view()->tqrepaintAll( view()->part()->document().selection()->boundingBox() ); } } @@ -169,18 +169,18 @@ VPatternTool::deactivate() VStrokeFillPreview* preview = view()->strokeFillPreview(); if( preview ) { - disconnect( preview, SIGNAL( fillSelected() ), this, SLOT( targetChanged() ) ); - disconnect( preview, SIGNAL( strokeSelected() ), this, SLOT( targetChanged() ) ); + disconnect( preview, TQT_SIGNAL( fillSelected() ), this, TQT_SLOT( targetChanged() ) ); + disconnect( preview, TQT_SIGNAL( strokeSelected() ), this, TQT_SLOT( targetChanged() ) ); } - view()->repaintAll( view()->part()->document().selection()->boundingBox() ); + view()->tqrepaintAll( view()->part()->document().selection()->boundingBox() ); } } -QString +TQString VPatternTool::contextHelp() { - QString s = i18n( "<qt><b>Pattern tool:</b><br>" ); + TQString s = i18n( "<qt><b>Pattern tool:</b><br>" ); s += i18n( "<i>Click</i> on the pattern you want in the chooser.<br>" ); s += i18n( "<i>Click and drag</i> to choose the pattern vector.</qt>" ); s += i18n( "<i>Press i or Shift+i</i> to decrease or increase the handle size.<br>" ); @@ -193,9 +193,9 @@ void VPatternTool::draw() return; VPainter *painter = view()->painterFactory()->editpainter(); - painter->setRasterOp( Qt::NotROP ); + painter->setRasterOp( TQt::NotROP ); - painter->setPen( Qt::DotLine ); + painter->setPen( TQt::DotLine ); // differentiate between moving a handle and creating a complete new vector if( m_state == moveOrigin || m_state == moveVector ) @@ -266,9 +266,9 @@ VPatternTool::draw( VPainter* painter ) m_origin = KoRect( s.x()-m_handleSize, s.y()-m_handleSize, 2*m_handleSize, 2*m_handleSize ); m_vector = KoRect( e.x()-m_handleSize, e.y()-m_handleSize, 2*m_handleSize, 2*m_handleSize ); - painter->setPen( Qt::blue.light() ); - painter->setBrush( Qt::blue.light() ); - painter->setRasterOp( Qt::XorROP ); + painter->setPen( TQt::blue.light() ); + painter->setBrush( TQt::blue.light() ); + painter->setRasterOp( TQt::XorROP ); // draw the pattern vector painter->newPath(); @@ -300,12 +300,12 @@ VPatternTool::mouseButtonPress() m_current = first(); // set the apropriate editing state - if( m_origin.contains( m_current ) ) + if( m_origin.tqcontains( m_current ) ) { m_state = moveOrigin; m_fixed = m_vector.center(); } - else if( m_vector.contains( m_current ) ) + else if( m_vector.tqcontains( m_current ) ) { m_state = moveVector; m_fixed = m_origin.center(); @@ -327,7 +327,7 @@ VPatternTool::mouseButtonRelease() if( first() == last() ) { - if( showDialog() != QDialog::Accepted ) + if( showDialog() != TQDialog::Accepted ) return; } @@ -449,7 +449,7 @@ VPatternTool::cancel() bool VPatternTool::showDialog() const { - return m_optionsWidget->exec() == QDialog::Accepted; + return m_optionsWidget->exec() == TQDialog::Accepted; } void @@ -459,7 +459,7 @@ VPatternTool::setup( KActionCollection *collection ) if( m_action == 0 ) { - m_action = new KRadioAction( i18n( "Pattern Tool" ), "14_pattern", Qt::SHIFT+Qt::Key_H, this, SLOT( activate() ), collection, name() ); + m_action = new KRadioAction( i18n( "Pattern Tool" ), "14_pattern", TQt::SHIFT+TQt::Key_H, this, TQT_SLOT( activate() ), collection, name() ); m_action->setToolTip( i18n( "Pattern" ) ); m_action->setExclusiveGroup( "misc" ); //m_ownAction = true; @@ -472,19 +472,19 @@ VPatternTool::setCursor() const if( !view() ) return; // set a different cursor if mouse is inside the handle rects - if( m_origin.contains( last() ) || m_vector.contains( last() ) ) - view()->setCursor( QCursor( Qt::SizeAllCursor ) ); + if( m_origin.tqcontains( last() ) || m_vector.tqcontains( last() ) ) + view()->setCursor( TQCursor( TQt::SizeAllCursor ) ); else - view()->setCursor( QCursor( Qt::arrowCursor ) ); + view()->setCursor( TQCursor( TQt::arrowCursor ) ); } bool -VPatternTool::keyReleased( Qt::Key key ) +VPatternTool::keyReleased( TQt::Key key ) { // increase/decrease the handle size switch( key ) { - case Qt::Key_I: + case TQt::Key_I: if( shiftPressed() ) m_handleSize++; else if( m_handleSize > 3 ) @@ -494,7 +494,7 @@ VPatternTool::keyReleased( Qt::Key key ) } if( view() ) - view()->repaintAll( view()->part()->document().selection()->boundingBox() ); + view()->tqrepaintAll( view()->part()->document().selection()->boundingBox() ); return true; } @@ -503,7 +503,7 @@ void VPatternTool::targetChanged() { if( view() ) - view()->repaintAll( view()->part()->document().selection()->boundingBox() ); + view()->tqrepaintAll( view()->part()->document().selection()->boundingBox() ); } #include "vpatterntool.moc" |