diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/canvasitemparts.h | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-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.h')
-rw-r--r-- | src/canvasitemparts.h | 148 |
1 files changed, 76 insertions, 72 deletions
diff --git a/src/canvasitemparts.h b/src/canvasitemparts.h index 44bd6be..f2fee2b 100644 --- a/src/canvasitemparts.h +++ b/src/canvasitemparts.h @@ -11,32 +11,33 @@ #ifndef CANVASITEMPARTS_H #define CANVASITEMPARTS_H -#include <qcanvas.h> -#include <qguardedptr.h> -#include <qslider.h> -#include <qtoolbutton.h> +#include <tqcanvas.h> +#include <tqguardedptr.h> +#include <tqslider.h> +#include <tqtoolbutton.h> class Cells; class CIWidgetMgr; class CNItem; class SliderWidget; class ToolButton; -class QString; +class TQString; -class GuiPart : public QObject, public QCanvasRectangle +class GuiPart : public TQObject, public TQCanvasRectangle { Q_OBJECT + TQ_OBJECT public: /** * Create a GuiPart. Control the position using setGuiPartSize, instead - * of calling QCanvasRectangle::setSize. This allows GuiPart to know + * of calling TQCanvasRectangle::setSize. This allows GuiPart to know * when its size has been changed */ - GuiPart( CNItem *parent, const QRect & r, QCanvas * canvas ); + GuiPart( CNItem *tqparent, const TQRect & r, TQCanvas * canvas ); virtual ~GuiPart(); - virtual QRect recommendedRect() const { return m_originalRect; } - void setOriginalRect( const QRect & r ) { m_originalRect = r; } + virtual TQRect recommendedRect() const { return m_originalRect; } + void setOriginalRect( const TQRect & r ) { m_originalRect = r; } virtual void updateConnectorPoints( bool add ); @@ -49,18 +50,18 @@ class GuiPart : public QObject, public QCanvasRectangle */ void setAngleDegrees( int angleDegrees ); /** - * Control the size. Call this instead of QCanvasRectangle::setSize. In + * Control the size. Call this instead of TQCanvasRectangle::setSize. In * turn, this function will notify subclasses via posChanged(); */ void setGuiPartSize( int width, int height ); /** * Returns the rectangle to draw in to compensate for rotation of - * the QPainter + * the TQPainter */ - QRect drawRect(); + TQRect drawRect(); int angleDegrees() const { return m_angleDegrees; } - CNItem *parent() const { return p_parent; } + CNItem *tqparent() const { return p_parent; } protected: /** @@ -71,16 +72,16 @@ class GuiPart : public QObject, public QCanvasRectangle * Rotate / etc the painter. You must call deinitPainter after * calling this function. */ - void initPainter( QPainter & p ); + void initPainter( TQPainter & p ); /** * Complement function to initPainter - restores painter to normal * transform */ - void deinitPainter( QPainter & p ); + void deinitPainter( TQPainter & p ); int m_angleDegrees; CNItem *p_parent; bool b_pointsAdded; - QRect m_originalRect; + TQRect m_originalRect; private slots: void slotMoveBy( double dx, double dy ); @@ -94,20 +95,21 @@ class GuiPart : public QObject, public QCanvasRectangle class Text : public GuiPart { Q_OBJECT + TQ_OBJECT public: - Text( const QString &text, CNItem *parent, const QRect & r, QCanvas * canvas, int flags = Qt::AlignHCenter | Qt::AlignVCenter ); + Text( const TQString &text, CNItem *tqparent, const TQRect & r, TQCanvas * canvas, int flags = TQt::AlignHCenter | TQt::AlignVCenter ); ~Text(); /** * Set the text, returning true if the size of this Text on the canvas * has changed. */ - bool setText( const QString & text ); - virtual QRect recommendedRect() const; - virtual void drawShape ( QPainter & p ); + bool setText( const TQString & text ); + virtual TQRect recommendedRect() const; + virtual void drawShape ( TQPainter & p ); /** - * The text flags (see QPainter::drawText) - Qt::AlignmentFlags and - * Qt::TextFlags OR'd together. + * The text flags (see TQPainter::drawText) - TQt::AlignmentFlags and + * TQt::TextFlags OR'd together. */ int flags() const { return m_flags; } /** @@ -116,26 +118,26 @@ class Text : public GuiPart void setFlags( int flags ); protected: - QString m_text; + TQString m_text; int m_flags; }; -typedef QMap<QString, QGuardedPtr<Text> > TextMap; +typedef TQMap<TQString, TQGuardedPtr<Text> > TextMap; /** -@short Base class for embedding Qt Widgets into the canvas +@short Base class for embedding TQt Widgets into the canvas @author David Saxton */ class Widget : public GuiPart { public: - Widget( const QString & id, CNItem *parent, const QRect & r, QCanvas * canvas ); + Widget( const TQString & id, CNItem *tqparent, const TQRect & r, TQCanvas * canvas ); ~Widget(); virtual int rtti() const; - virtual QWidget *widget() const = 0; - QString id() const { return m_id; } + virtual TQWidget *widget() const = 0; + TQString id() const { return m_id; } /** * Set the widget enabled/disabled @@ -148,52 +150,52 @@ class Widget : public GuiPart /** * Mouse was pressed. pos is given relative to CNItem position. */ - virtual void mousePressEvent( QMouseEvent *e ) { Q_UNUSED(e); } + virtual void mousePressEvent( TQMouseEvent *e ) { Q_UNUSED(e); } /** * Mouse was released. pos is given relative to CNItem position. */ - virtual void mouseReleaseEvent( QMouseEvent *e ) { Q_UNUSED(e); } + virtual void mouseReleaseEvent( TQMouseEvent *e ) { Q_UNUSED(e); } /** * Mouse was double clicked. pos is given relative to CNItem position. */ - virtual void mouseDoubleClickEvent( QMouseEvent *e ) { Q_UNUSED(e); } + virtual void mouseDoubleClickEvent( TQMouseEvent *e ) { Q_UNUSED(e); } /** * Mouse was moved. pos is given relative to CNItem position. */ - virtual void mouseMoveEvent( QMouseEvent *e ) { Q_UNUSED(e); } + virtual void mouseMoveEvent( TQMouseEvent *e ) { Q_UNUSED(e); } /** * Mouse was scrolled. pos is given relative to CNItem position. */ - virtual void wheelEvent( QWheelEvent *e ) { Q_UNUSED(e); } + virtual void wheelEvent( TQWheelEvent *e ) { Q_UNUSED(e); } - virtual void drawShape( QPainter &p ); + virtual void drawShape( TQPainter &p ); protected: virtual void posChanged(); - QString m_id; + TQString m_id; }; -class ToolButton : public QToolButton +class ToolButton : public TQToolButton { public: - ToolButton( QWidget* parent ); + ToolButton( TQWidget* tqparent ); - virtual void mousePressEvent( QMouseEvent *e ) { QToolButton::mousePressEvent(e); } - virtual void mouseReleaseEvent( QMouseEvent *e ) { QToolButton::mouseReleaseEvent(e); } - virtual void mouseDoubleClickEvent ( QMouseEvent *e ) { QToolButton::mouseDoubleClickEvent(e); } - virtual void mouseMoveEvent( QMouseEvent *e ) { QToolButton::mouseMoveEvent(e); } - virtual void wheelEvent( QWheelEvent *e ) { QToolButton::wheelEvent(e); } - virtual void enterEvent() { QToolButton::enterEvent(0l); } - virtual void leaveEvent() { QToolButton::leaveEvent(0l); } + virtual void mousePressEvent( TQMouseEvent *e ) { TQToolButton::mousePressEvent(e); } + virtual void mouseReleaseEvent( TQMouseEvent *e ) { TQToolButton::mouseReleaseEvent(e); } + virtual void mouseDoubleClickEvent ( TQMouseEvent *e ) { TQToolButton::mouseDoubleClickEvent(e); } + virtual void mouseMoveEvent( TQMouseEvent *e ) { TQToolButton::mouseMoveEvent(e); } + virtual void wheelEvent( TQWheelEvent *e ) { TQToolButton::wheelEvent(e); } + virtual void enterEvent() { TQToolButton::enterEvent(0l); } + virtual void leaveEvent() { TQToolButton::leaveEvent(0l); } void setAngleDegrees( int angleDegrees ) { m_angleDegrees = angleDegrees; } protected: - virtual void drawButtonLabel( QPainter * p ); + virtual void drawButtonLabel( TQPainter * p ); int m_angleDegrees; - QFont m_font; + TQFont m_font; }; @@ -204,26 +206,27 @@ class ToolButton : public QToolButton class Button : public Widget { Q_OBJECT + TQ_OBJECT public: - Button( const QString & id, CNItem *parent, bool isToggle, const QRect & r, QCanvas * canvas ); + Button( const TQString & id, CNItem *tqparent, bool isToggle, const TQRect & r, TQCanvas * canvas ); ~Button(); - virtual void mousePressEvent( QMouseEvent *e ); - virtual void mouseReleaseEvent( QMouseEvent *e ); + virtual void mousePressEvent( TQMouseEvent *e ); + virtual void mouseReleaseEvent( TQMouseEvent *e ); virtual void enterEvent(); virtual void leaveEvent(); /** * Set the text displayed inside the button */ - void setText( const QString &text ); + void setText( const TQString &text ); void setToggle( bool toggle ); bool isToggle() const { return b_isToggle; } - virtual QWidget *widget() const; + virtual TQWidget *widget() const; bool state() const; - void setPixmap( const QPixmap & ); + void setPixmap( const TQPixmap & ); void setState( bool state ); - virtual QRect recommendedRect() const; + virtual TQRect recommendedRect() const; protected: virtual void posChanged(); @@ -237,41 +240,42 @@ class Button : public Widget }; -class SliderWidget : public QSlider +class SliderWidget : public TQSlider { public: - SliderWidget( QWidget* parent ); + SliderWidget( TQWidget* tqparent ); - virtual void mousePressEvent( QMouseEvent *e ) { QSlider::mousePressEvent(e); } - virtual void mouseReleaseEvent( QMouseEvent *e ) { QSlider::mouseReleaseEvent(e); } - virtual void mouseDoubleClickEvent ( QMouseEvent *e ) { QSlider::mouseDoubleClickEvent(e); } - virtual void mouseMoveEvent( QMouseEvent *e ) { QSlider::mouseMoveEvent(e); } - virtual void wheelEvent( QWheelEvent *e ) { QSlider::wheelEvent(e); } - virtual void enterEvent() { QSlider::enterEvent(0l); } - virtual void leaveEvent() { QSlider::leaveEvent(0l); } + virtual void mousePressEvent( TQMouseEvent *e ) { TQSlider::mousePressEvent(e); } + virtual void mouseReleaseEvent( TQMouseEvent *e ) { TQSlider::mouseReleaseEvent(e); } + virtual void mouseDoubleClickEvent ( TQMouseEvent *e ) { TQSlider::mouseDoubleClickEvent(e); } + virtual void mouseMoveEvent( TQMouseEvent *e ) { TQSlider::mouseMoveEvent(e); } + virtual void wheelEvent( TQWheelEvent *e ) { TQSlider::wheelEvent(e); } + virtual void enterEvent() { TQSlider::enterEvent((TQEvent*)0l); } + virtual void leaveEvent() { TQSlider::leaveEvent((TQEvent*)0l); } }; /** -@short Stores internal information about a QSlider associated with CNItem +@short Stores internal information about a TQSlider associated with CNItem @author David Saxton */ class Slider : public Widget { Q_OBJECT + TQ_OBJECT public: - Slider( const QString & id, CNItem *parent, const QRect & r, QCanvas * canvas ); + Slider( const TQString & id, CNItem *tqparent, const TQRect & r, TQCanvas * canvas ); ~Slider(); - virtual void mousePressEvent( QMouseEvent *e ); - virtual void mouseReleaseEvent( QMouseEvent *e ); - virtual void mouseDoubleClickEvent ( QMouseEvent *e ); - virtual void mouseMoveEvent( QMouseEvent *e ); - virtual void wheelEvent( QWheelEvent *e ); + virtual void mousePressEvent( TQMouseEvent *e ); + virtual void mouseReleaseEvent( TQMouseEvent *e ); + virtual void mouseDoubleClickEvent ( TQMouseEvent *e ); + virtual void mouseMoveEvent( TQMouseEvent *e ); + virtual void wheelEvent( TQWheelEvent *e ); virtual void enterEvent(); virtual void leaveEvent(); - virtual QWidget *widget() const; + virtual TQWidget *widget() const; int value() const; void setValue( int value ); void setOrientation( Qt::Orientation o ); @@ -284,7 +288,7 @@ class Slider : public Widget private: SliderWidget *m_slider; - Orientation m_orientation; + Qt::Orientation m_orientation; }; #endif |