summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/designer/styledbutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdevdesigner/designer/styledbutton.cpp')
-rw-r--r--kdevdesigner/designer/styledbutton.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/kdevdesigner/designer/styledbutton.cpp b/kdevdesigner/designer/styledbutton.cpp
index 41389684..45c425b4 100644
--- a/kdevdesigner/designer/styledbutton.cpp
+++ b/kdevdesigner/designer/styledbutton.cpp
@@ -24,33 +24,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 <qcolordialog.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 <tqcolordialog.h>
+#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();
@@ -75,17 +75,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;
@@ -93,12 +93,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;
}
@@ -117,14 +117,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()
@@ -132,8 +132,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 {
@@ -143,39 +143,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 );
}
@@ -184,18 +184,18 @@ void StyledButton::onEditor()
{
switch (edit) {
case ColorEditor: {
- QColor c = QColorDialog::getColor( palette().active().background(), this );
+ TQColor c = QColorDialog::getColor( palette().active().background(), this );
if ( c.isValid() ) {
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();
@@ -206,25 +206,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 );
@@ -232,8 +232,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;
@@ -244,46 +244,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();