summaryrefslogtreecommitdiffstats
path: root/src/canvasitemparts.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
commit87a016680e3677da3993f333561e79eb0cead7d5 (patch)
treecbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/canvasitemparts.cpp
parent6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff)
downloadktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz
ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/canvasitemparts.cpp')
-rw-r--r--src/canvasitemparts.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/src/canvasitemparts.cpp b/src/canvasitemparts.cpp
index 7f4b03d..dc98647 100644
--- a/src/canvasitemparts.cpp
+++ b/src/canvasitemparts.cpp
@@ -13,20 +13,20 @@
#include "cnitem.h"
#include "icndocument.h"
-#include <qpainter.h>
+#include <tqpainter.h>
//BEGIN Class GuiPart
-GuiPart::GuiPart( CNItem *parent, const QRect & r, QCanvas * canvas )
- : QObject(parent),
- QCanvasRectangle( r, canvas ),
+GuiPart::GuiPart( CNItem *tqparent, const TQRect & r, TQCanvas * canvas )
+ : TQObject(tqparent),
+ TQCanvasRectangle( r, canvas ),
m_angleDegrees(0),
- p_parent(parent),
+ p_parent(tqparent),
b_pointsAdded(false),
m_originalRect(r)
{
- connect( parent, SIGNAL(movedBy(double, double )), this, SLOT(slotMoveBy(double, double )) );
- setZ( parent->z() + 0.5 );
+ connect( tqparent, TQT_SIGNAL(movedBy(double, double )), this, TQT_SLOT(slotMoveBy(double, double )) );
+ setZ( tqparent->z() + 0.5 );
}
@@ -53,7 +53,7 @@ void GuiPart::setGuiPartSize( int width, int height )
}
-void GuiPart::initPainter( QPainter &p )
+void GuiPart::initPainter( TQPainter &p )
{
if ( (m_angleDegrees%180) == 0 )
return;
@@ -64,7 +64,7 @@ void GuiPart::initPainter( QPainter &p )
}
-void GuiPart::deinitPainter( QPainter &p )
+void GuiPart::deinitPainter( TQPainter &p )
{
if ( (m_angleDegrees%180) == 0 )
return;
@@ -117,12 +117,12 @@ void GuiPart::updateConnectorPoints( bool add )
}
-QRect GuiPart::drawRect()
+TQRect GuiPart::drawRect()
{
- QRect dr = rect();
+ TQRect dr = rect();
if ( m_angleDegrees%180 != 0 )
{
- QWMatrix m;
+ TQWMatrix m;
m.translate( int(x()+(width()/2)), int(y()+(height()/2)) );
if ( (m_angleDegrees%180) != 0 )
@@ -139,8 +139,8 @@ QRect GuiPart::drawRect()
//BEGIN Class Text
-Text::Text( const QString &text, CNItem *parent, const QRect & r, QCanvas * canvas, int flags )
- : GuiPart( parent, r, canvas )
+Text::Text( const TQString &text, CNItem *tqparent, const TQRect & r, TQCanvas * canvas, int flags )
+ : GuiPart( tqparent, r, canvas )
{
m_flags = flags;
setText(text);
@@ -152,7 +152,7 @@ Text::~Text()
}
-bool Text::setText( const QString & text )
+bool Text::setText( const TQString & text )
{
if ( m_text == text )
return false;
@@ -171,7 +171,7 @@ void Text::setFlags( int flags )
}
-void Text::drawShape( QPainter & p )
+void Text::drawShape( TQPainter & p )
{
initPainter(p);
p.setFont( p_parent->font() );
@@ -180,17 +180,17 @@ void Text::drawShape( QPainter & p )
}
-QRect Text::recommendedRect() const
+TQRect Text::recommendedRect() const
{
- return QFontMetrics( p_parent->font() ).boundingRect( m_originalRect.x(), m_originalRect.y(), m_originalRect.width(), m_originalRect.height(), m_flags, m_text );
+ return TQFontMetrics( p_parent->font() ).boundingRect( m_originalRect.x(), m_originalRect.y(), m_originalRect.width(), m_originalRect.height(), m_flags, m_text );
}
//END Class Text
//BEGIN Class Widget
-Widget::Widget( const QString & id, CNItem * parent, const QRect & r, QCanvas * canvas )
- : GuiPart( parent, r, canvas )
+Widget::Widget( const TQString & id, CNItem * tqparent, const TQRect & r, TQCanvas * canvas )
+ : GuiPart( tqparent, r, canvas )
{
m_id = id;
show();
@@ -217,7 +217,7 @@ void Widget::posChanged()
{
// Swap around the width / height if we are rotated at a non-half way around
if ( m_angleDegrees%90 != 0 )
- widget()->setFixedSize( QSize( height(), width() ) );
+ widget()->setFixedSize( TQSize( height(), width() ) );
else
widget()->setFixedSize( size() );
@@ -225,30 +225,30 @@ void Widget::posChanged()
}
-void Widget::drawShape( QPainter &p )
+void Widget::drawShape( TQPainter &p )
{
// initPainter(p);
- p.drawPixmap( int(x()), int(y()), QPixmap::grabWidget( widget() ) );
+ p.drawPixmap( int(x()), int(y()), TQPixmap::grabWidget( widget() ) );
// deinitPainter(p);
}
//END Class Widget
//BEGIN Class ToolButton
-ToolButton::ToolButton( QWidget *parent )
- : QToolButton(parent)
+ToolButton::ToolButton( TQWidget *tqparent )
+ : TQToolButton(tqparent)
{
m_angleDegrees = 0;
- if ( QFontInfo(m_font).pixelSize() > 11 ) // It has to be > 11, not > 12, as (I think) pixelSize() rounds off the actual size
+ if ( TQFontInfo(m_font).pixelSize() > 11 ) // It has to be > 11, not > 12, as (I think) pixelSize() rounds off the actual size
m_font.setPixelSize(12);
}
-void ToolButton::drawButtonLabel( QPainter * p )
+void ToolButton::drawButtonLabel( TQPainter * p )
{
if ( m_angleDegrees % 180 == 0 || text().isEmpty() )
{
- QToolButton::drawButtonLabel(p);
+ TQToolButton::drawButtonLabel(p);
return;
}
@@ -263,8 +263,8 @@ void ToolButton::drawButtonLabel( QPainter * p )
int m = width() > height() ? width() : height();
- p->setPen( Qt::black );
- p->drawText( isDown()?1:0, isDown()?1:0, m, m, Qt::AlignVCenter | Qt::AlignHCenter, text() );
+ p->setPen( TQt::black );
+ p->drawText( isDown()?1:0, isDown()?1:0, m, m, TQt::AlignVCenter | TQt::AlignHCenter, text() );
p->translate( dy-dx, 0 );
@@ -276,15 +276,15 @@ void ToolButton::drawButtonLabel( QPainter * p )
//BEGIN Class Button
-Button::Button( const QString & id, CNItem * parent, bool isToggle, const QRect & r, QCanvas * canvas )
- : Widget( id, parent, r, canvas )
+Button::Button( const TQString & id, CNItem * tqparent, bool isToggle, const TQRect & r, TQCanvas * canvas )
+ : Widget( id, tqparent, r, canvas )
{
b_isToggle = isToggle;
m_button = new ToolButton(0l);
m_button->setUsesTextLabel(false);
m_button->setToggleButton(b_isToggle);
- connect( m_button, SIGNAL(pressed()), this, SLOT(slotStateChanged()) );
- connect( m_button, SIGNAL(released()), this, SLOT(slotStateChanged()) );
+ connect( m_button, TQT_SIGNAL(pressed()), this, TQT_SLOT(slotStateChanged()) );
+ connect( m_button, TQT_SIGNAL(released()), this, TQT_SLOT(slotStateChanged()) );
posChanged();
}
@@ -319,13 +319,13 @@ void Button::posChanged()
void Button::slotStateChanged()
{
- parent()->buttonStateChanged( id(), m_button->isDown() || m_button->isOn() );
+ tqparent()->buttonStateChanged( id(), m_button->isDown() || m_button->isOn() );
}
-QWidget* Button::widget() const
+TQWidget* Button::widget() const
{
return m_button;
}
-void Button::setPixmap( const QPixmap &p )
+void Button::setPixmap( const TQPixmap &p )
{
m_button->setPixmap(p);
}
@@ -350,23 +350,23 @@ bool Button::state() const
}
-QRect Button::recommendedRect() const
+TQRect Button::recommendedRect() const
{
- QSize sizeHint = m_button->sizeHint();
- if ( sizeHint.width() < m_originalRect.width() )
- sizeHint.setWidth( m_originalRect.width() );
+ TQSize tqsizeHint = m_button->tqsizeHint();
+ if ( tqsizeHint.width() < m_originalRect.width() )
+ tqsizeHint.setWidth( m_originalRect.width() );
// Hmm...for now, lets just keep the recomended rect the same height as the original rect
- sizeHint.setHeight( m_originalRect.height() );
+ tqsizeHint.setHeight( m_originalRect.height() );
- int hdw = (sizeHint.width() - m_originalRect.width())/2;
- int hdh = (sizeHint.height() - m_originalRect.height())/2;
+ int hdw = (tqsizeHint.width() - m_originalRect.width())/2;
+ int hdh = (tqsizeHint.height() - m_originalRect.height())/2;
- return QRect( m_originalRect.x()-hdw, m_originalRect.y()-hdh, sizeHint.width(), sizeHint.height() );
+ return TQRect( m_originalRect.x()-hdw, m_originalRect.y()-hdh, tqsizeHint.width(), tqsizeHint.height() );
}
-void Button::setText( const QString &text )
+void Button::setText( const TQString &text )
{
if ( m_button->text() == text )
return;
@@ -381,12 +381,12 @@ void Button::setText( const QString &text )
}
-void Button::mousePressEvent( QMouseEvent *e )
+void Button::mousePressEvent( TQMouseEvent *e )
{
if ( !m_button->isEnabled() )
return;
- QMouseEvent event( QEvent::MouseButtonPress, e->pos()-QPoint(int(x()),int(y())), e->button(), e->state() );
+ TQMouseEvent event( TQEvent::MouseButtonPress, e->pos()-TQPoint(int(x()),int(y())), e->button(), e->state() );
m_button->mousePressEvent(&event);
if (event.isAccepted())
e->accept();
@@ -394,9 +394,9 @@ void Button::mousePressEvent( QMouseEvent *e )
}
-void Button::mouseReleaseEvent( QMouseEvent *e )
+void Button::mouseReleaseEvent( TQMouseEvent *e )
{
- QMouseEvent event( QEvent::MouseButtonRelease, e->pos()-QPoint(int(x()),int(y())), e->button(), e->state() );
+ TQMouseEvent event( TQEvent::MouseButtonRelease, e->pos()-TQPoint(int(x()),int(y())), e->button(), e->state() );
m_button->mouseReleaseEvent(&event);
if (event.isAccepted())
e->accept();
@@ -425,8 +425,8 @@ void Button::leaveEvent()
//BEGIN Class SliderWidget
-SliderWidget::SliderWidget( QWidget *parent )
- : QSlider(parent)
+SliderWidget::SliderWidget( TQWidget *tqparent )
+ : TQSlider(tqparent)
{
setWFlags(WNoAutoErase|WRepaintNoErase);
}
@@ -434,16 +434,16 @@ SliderWidget::SliderWidget( QWidget *parent )
//BEGIN Class Slider
-Slider::Slider( const QString & id, CNItem * parent, const QRect & r, QCanvas * canvas )
- : Widget( id, parent, r, canvas )
+Slider::Slider( const TQString & id, CNItem * tqparent, const TQRect & r, TQCanvas * canvas )
+ : Widget( id, tqparent, r, canvas )
{
m_orientation = Qt::Vertical;
m_slider = new SliderWidget(0l);
- m_slider->setPaletteBackgroundColor(Qt::white);
- m_slider->setPaletteForegroundColor(Qt::white);
- m_slider->setEraseColor(Qt::white);
- m_slider->setBackgroundMode( Qt::NoBackground );
- connect( m_slider, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged(int)) );
+ m_slider->setPaletteBackgroundColor(TQt::white);
+ m_slider->setPaletteForegroundColor(TQt::white);
+ m_slider->setEraseColor(TQt::white);
+ m_slider->setBackgroundMode( TQt::NoBackground );
+ connect( m_slider, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotValueChanged(int)) );
posChanged();
}
@@ -454,7 +454,7 @@ Slider::~Slider()
}
-QWidget* Slider::widget() const
+TQWidget* Slider::widget() const
{
return m_slider;
}
@@ -471,44 +471,44 @@ void Slider::setValue( int value )
}
-void Slider::mousePressEvent( QMouseEvent *e )
+void Slider::mousePressEvent( TQMouseEvent *e )
{
- QMouseEvent event( QEvent::MouseButtonPress, e->pos()-QPoint(int(x()),int(y())), e->button(), e->state() );
+ TQMouseEvent event( TQEvent::MouseButtonPress, e->pos()-TQPoint(int(x()),int(y())), e->button(), e->state() );
m_slider->mousePressEvent(&event);
if (event.isAccepted())
e->accept();
canvas()->setChanged( rect() );
}
-void Slider::mouseReleaseEvent( QMouseEvent *e )
+void Slider::mouseReleaseEvent( TQMouseEvent *e )
{
- QMouseEvent event( QEvent::MouseButtonRelease, e->pos()-QPoint(int(x()),int(y())), e->button(), e->state() );
+ TQMouseEvent event( TQEvent::MouseButtonRelease, e->pos()-TQPoint(int(x()),int(y())), e->button(), e->state() );
m_slider->mouseReleaseEvent(&event);
if (event.isAccepted())
e->accept();
canvas()->setChanged( rect() );
}
-void Slider::mouseDoubleClickEvent ( QMouseEvent *e )
+void Slider::mouseDoubleClickEvent ( TQMouseEvent *e )
{
- QMouseEvent event( QEvent::MouseButtonDblClick, e->pos()-QPoint(int(x()),int(y())), e->button(), e->state() );
+ TQMouseEvent event( TQEvent::MouseButtonDblClick, e->pos()-TQPoint(int(x()),int(y())), e->button(), e->state() );
m_slider->mouseDoubleClickEvent(&event);
if (event.isAccepted())
e->accept();
canvas()->setChanged( rect() );
}
-void Slider::mouseMoveEvent( QMouseEvent *e )
+void Slider::mouseMoveEvent( TQMouseEvent *e )
{
- QMouseEvent event( QEvent::MouseMove, e->pos()-QPoint(int(x()),int(y())), e->button(), e->state() );
+ TQMouseEvent event( TQEvent::MouseMove, e->pos()-TQPoint(int(x()),int(y())), e->button(), e->state() );
m_slider->mouseMoveEvent(&event);
if (event.isAccepted())
e->accept();
}
-void Slider::wheelEvent( QWheelEvent *e )
+void Slider::wheelEvent( TQWheelEvent *e )
{
- QWheelEvent event( e->pos()-QPoint(int(x()),int(y())), e->delta(), e->state(), e->orientation() );
+ TQWheelEvent event( e->pos()-TQPoint(int(x()),int(y())), e->delta(), e->state(), e->orientation() );
m_slider->wheelEvent(&event);
if (event.isAccepted())
e->accept();
@@ -527,8 +527,8 @@ void Slider::leaveEvent()
void Slider::slotValueChanged( int value )
{
- parent()->itemDocument()->setModified(true);
- parent()->sliderValueChanged(id(),value);
+ tqparent()->itemDocument()->setModified(true);
+ tqparent()->sliderValueChanged(id(),value);
}
void Slider::setOrientation( Qt::Orientation o )