diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:54:04 +0000 |
commit | dc6b8e72fed2586239e3514819238c520636c9d9 (patch) | |
tree | 88b200df0a0b7fab9d6f147596173556f1ed9a13 /kommander/editor/styledbutton.cpp | |
parent | 6927d4436e54551917f600b706a8d6109e49de1c (diff) | |
download | tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.tar.gz tdewebdev-dc6b8e72fed2586239e3514819238c520636c9d9.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1157656 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kommander/editor/styledbutton.cpp')
-rw-r--r-- | kommander/editor/styledbutton.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/kommander/editor/styledbutton.cpp b/kommander/editor/styledbutton.cpp index 9b77b941..4502b2a3 100644 --- a/kommander/editor/styledbutton.cpp +++ b/kommander/editor/styledbutton.cpp @@ -18,33 +18,33 @@ ** **********************************************************************/ -#include <qvariant.h> // HP-UX compiler needs this here +#include <tqvariant.h> // HP-UX compiler needs this here #include "styledbutton.h" #include "formwindow.h" #include "pixmapchooser.h" #include <kcolordialog.h> -#include <qpalette.h> -#include <qlabel.h> -#include <qpainter.h> -#include <qimage.h> -#include <qpixmap.h> -#include <qapplication.h> -#include <qdragobject.h> -#include <qstyle.h> - -StyledButton::StyledButton(QWidget* parent, const char* name) - : QButton( parent, name ), pix( 0 ), spix( 0 ), s( 0 ), formWindow( 0 ), mousePressed( false ) +#include <tqpalette.h> +#include <tqlabel.h> +#include <tqpainter.h> +#include <tqimage.h> +#include <tqpixmap.h> +#include <tqapplication.h> +#include <tqdragobject.h> +#include <tqstyle.h> + +StyledButton::StyledButton(TQWidget* parent, const char* name) + : TQButton( parent, name ), pix( 0 ), spix( 0 ), s( 0 ), formWindow( 0 ), mousePressed( false ) { setMinimumSize( minimumSizeHint() ); setAcceptDrops( true ); - connect( this, SIGNAL(clicked()), SLOT(onEditor())); + connect( this, TQT_SIGNAL(clicked()), TQT_SLOT(onEditor())); setEditor( ColorEditor ); } -StyledButton::StyledButton( const QBrush& b, QWidget* parent, const char* name, WFlags f ) - : QButton( parent, name, f ), spix( 0 ), s( 0 ), formWindow( 0 ) +StyledButton::StyledButton( const TQBrush& b, TQWidget* parent, const char* name, WFlags f ) + : TQButton( parent, name, f ), spix( 0 ), s( 0 ), formWindow( 0 ) { col = b.color(); pix = b.pixmap(); @@ -69,17 +69,17 @@ StyledButton::EditorType StyledButton::editor() const return edit; } -void StyledButton::setColor( const QColor& c ) +void StyledButton::setColor( const TQColor& c ) { col = c; update(); } -void StyledButton::setPixmap( const QPixmap & pm ) +void StyledButton::setPixmap( const TQPixmap & pm ) { if ( !pm.isNull() ) { delete pix; - pix = new QPixmap( pm ); + pix = new TQPixmap( pm ); } else { delete pix; pix = 0; @@ -87,12 +87,12 @@ void StyledButton::setPixmap( const QPixmap & pm ) scalePixmap(); } -QColor StyledButton::color() const +TQColor StyledButton::color() const { return col; } -QPixmap* StyledButton::pixmap() const +TQPixmap* StyledButton::pixmap() const { return pix; } @@ -111,14 +111,14 @@ void StyledButton::setScale( bool on ) scalePixmap(); } -QSize StyledButton::sizeHint() const +TQSize StyledButton::sizeHint() const { - return QSize( 50, 25 ); + return TQSize( 50, 25 ); } -QSize StyledButton::minimumSizeHint() const +TQSize StyledButton::minimumSizeHint() const { - return QSize( 50, 25 ); + return TQSize( 50, 25 ); } void StyledButton::scalePixmap() @@ -126,8 +126,8 @@ void StyledButton::scalePixmap() delete spix; if ( pix ) { - spix = new QPixmap( 6*width()/8, 6*height()/8 ); - QImage img = pix->convertToImage(); + spix = new TQPixmap( 6*width()/8, 6*height()/8 ); + TQImage img = pix->convertToImage(); spix->convertFromImage( s? img.smoothScale( 6*width()/8, 6*height()/8 ) : img ); } else { @@ -137,39 +137,39 @@ void StyledButton::scalePixmap() update(); } -void StyledButton::resizeEvent( QResizeEvent* e ) +void StyledButton::resizeEvent( TQResizeEvent* e ) { scalePixmap(); - QButton::resizeEvent( e ); + TQButton::resizeEvent( e ); } -void StyledButton::drawButton( QPainter *paint ) +void StyledButton::drawButton( TQPainter *paint ) { - style().drawPrimitive(QStyle::PE_ButtonBevel, paint, rect(), colorGroup(), - isDown() ? QStyle::Style_Sunken : QStyle::Style_Raised); + style().drawPrimitive(TQStyle::PE_ButtonBevel, paint, rect(), colorGroup(), + isDown() ? TQStyle::Style_Sunken : TQStyle::Style_Raised); drawButtonLabel(paint); if (hasFocus()) - style().drawPrimitive(QStyle::PE_FocusRect, paint, - style().subRect(QStyle::SR_PushButtonFocusRect, this), - colorGroup(), QStyle::Style_Default); + style().drawPrimitive(TQStyle::PE_FocusRect, paint, + style().subRect(TQStyle::SR_PushButtonFocusRect, this), + colorGroup(), TQStyle::Style_Default); } -void StyledButton::drawButtonLabel( QPainter *paint ) +void StyledButton::drawButtonLabel( TQPainter *paint ) { - QColor pen = isEnabled() ? + TQColor pen = isEnabled() ? hasFocus() ? palette().active().buttonText() : palette().inactive().buttonText() : palette().disabled().buttonText(); paint->setPen( pen ); if(!isEnabled()) { - paint->setBrush( QBrush( colorGroup().button() ) ); + paint->setBrush( TQBrush( colorGroup().button() ) ); } else if ( edit == PixmapEditor && spix ) { - paint->setBrush( QBrush( col, *spix ) ); + paint->setBrush( TQBrush( col, *spix ) ); paint->setBrushOrigin( width()/8, height()/8 ); } else - paint->setBrush( QBrush( col ) ); + paint->setBrush( TQBrush( col ) ); paint->drawRect( width()/8, height()/8, 6*width()/8, 6*height()/8 ); } @@ -178,18 +178,18 @@ void StyledButton::onEditor() { switch (edit) { case ColorEditor: { - QColor c = palette().active().background(); - if ( KColorDialog::getColor( c, this ) == QDialog::Accepted ) { + TQColor c = palette().active().background(); + if ( KColorDialog::getColor( c, this ) == TQDialog::Accepted ) { setColor( c ); emit changed(); } } break; case PixmapEditor: { - QPixmap p; + TQPixmap p; if ( pixmap() ) p = qChoosePixmap( this, formWindow, *pixmap() ); else - p = qChoosePixmap( this, formWindow, QPixmap() ); + p = qChoosePixmap( this, formWindow, TQPixmap() ); if ( !p.isNull() ) { setPixmap( p ); emit changed(); @@ -200,25 +200,25 @@ void StyledButton::onEditor() } } -void StyledButton::mousePressEvent(QMouseEvent* e) +void StyledButton::mousePressEvent(TQMouseEvent* e) { - QButton::mousePressEvent(e); + TQButton::mousePressEvent(e); mousePressed = true; pressPos = e->pos(); } -void StyledButton::mouseMoveEvent(QMouseEvent* e) +void StyledButton::mouseMoveEvent(TQMouseEvent* e) { - QButton::mouseMoveEvent( e ); + TQButton::mouseMoveEvent( e ); #ifndef QT_NO_DRAGANDDROP if ( !mousePressed ) return; - if ( ( pressPos - e->pos() ).manhattanLength() > QApplication::startDragDistance() ) { + if ( ( pressPos - e->pos() ).manhattanLength() > TQApplication::startDragDistance() ) { if ( edit == ColorEditor ) { - QColorDrag *drg = new QColorDrag( col, this ); - QPixmap pix( 25, 25 ); + TQColorDrag *drg = new TQColorDrag( col, this ); + TQPixmap pix( 25, 25 ); pix.fill( col ); - QPainter p( &pix ); + TQPainter p( &pix ); p.drawRect( 0, 0, pix.width(), pix.height() ); p.end(); drg->setPixmap( pix ); @@ -226,8 +226,8 @@ void StyledButton::mouseMoveEvent(QMouseEvent* e) drg->dragCopy(); } else if ( edit == PixmapEditor && pix && !pix->isNull() ) { - QImage img = pix->convertToImage(); - QImageDrag *drg = new QImageDrag( img, this ); + TQImage img = pix->convertToImage(); + TQImageDrag *drg = new TQImageDrag( img, this ); if(spix) drg->setPixmap( *spix ); mousePressed = false; @@ -238,46 +238,46 @@ void StyledButton::mouseMoveEvent(QMouseEvent* e) } #ifndef QT_NO_DRAGANDDROP -void StyledButton::dragEnterEvent( QDragEnterEvent *e ) +void StyledButton::dragEnterEvent( TQDragEnterEvent *e ) { setFocus(); - if ( edit == ColorEditor && QColorDrag::canDecode( e ) ) + if ( edit == ColorEditor && TQColorDrag::canDecode( e ) ) e->accept(); - else if ( edit == PixmapEditor && QImageDrag::canDecode( e ) ) + else if ( edit == PixmapEditor && TQImageDrag::canDecode( e ) ) e->accept(); else e->ignore(); } -void StyledButton::dragLeaveEvent( QDragLeaveEvent * ) +void StyledButton::dragLeaveEvent( TQDragLeaveEvent * ) { if ( hasFocus() ) parentWidget()->setFocus(); } -void StyledButton::dragMoveEvent( QDragMoveEvent *e ) +void StyledButton::dragMoveEvent( TQDragMoveEvent *e ) { - if ( edit == ColorEditor && QColorDrag::canDecode( e ) ) + if ( edit == ColorEditor && TQColorDrag::canDecode( e ) ) e->accept(); - else if ( edit == PixmapEditor && QImageDrag::canDecode( e ) ) + else if ( edit == PixmapEditor && TQImageDrag::canDecode( e ) ) e->accept(); else e->ignore(); } -void StyledButton::dropEvent( QDropEvent *e ) +void StyledButton::dropEvent( TQDropEvent *e ) { - if ( edit == ColorEditor && QColorDrag::canDecode( e ) ) { - QColor color; - QColorDrag::decode( e, color ); + if ( edit == ColorEditor && TQColorDrag::canDecode( e ) ) { + TQColor color; + TQColorDrag::decode( e, color ); setColor(color); emit changed(); e->accept(); } - else if ( edit == PixmapEditor && QImageDrag::canDecode( e ) ) { - QImage img; - QImageDrag::decode( e, img ); - QPixmap pm; + else if ( edit == PixmapEditor && TQImageDrag::canDecode( e ) ) { + TQImage img; + TQImageDrag::decode( e, img ); + TQPixmap pm; pm.convertFromImage(img); setPixmap(pm); emit changed(); |