summaryrefslogtreecommitdiffstats
path: root/src/item.h
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/item.h
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/item.h')
-rw-r--r--src/item.h111
1 files changed, 56 insertions, 55 deletions
diff --git a/src/item.h b/src/item.h
index f1968d2..7f65c7a 100644
--- a/src/item.h
+++ b/src/item.h
@@ -13,9 +13,9 @@
#include "variant.h"
-#include <qcanvas.h>
-#include <qfont.h>
-#include <qguardedptr.h>
+#include <tqcanvas.h>
+#include <tqfont.h>
+#include <tqguardedptr.h>
class Document;
@@ -27,22 +27,23 @@ class ItemView;
class DoubleSpinBox;
class Document;
class Variant;
-class QBitArray;
+class TQBitArray;
typedef Item*(*createItemPtr)( ItemDocument *itemDocument, bool newItem, const char *id );
-typedef QGuardedPtr<Item> GuardedItem;
-typedef QMap<QString, Variant*> VariantDataMap;
-typedef QValueList<GuardedItem> ItemList;
+typedef TQGuardedPtr<Item> GuardedItem;
+typedef TQMap<TQString, Variant*> VariantDataMap;
+typedef TQValueList<GuardedItem> ItemList;
/**
@author David Saxton
@author Daniel Clarke
*/
-class Item : public QObject, public QCanvasPolygon
+class Item : public TQObject, public TQCanvasPolygon
{
Q_OBJECT
+ TQ_OBJECT
public:
- Item( ItemDocument *itemDocument, bool newItem, const QString &id );
+ Item( ItemDocument *itemDocument, bool newItem, const TQString &id );
virtual ~Item();
/**
@@ -50,15 +51,15 @@ public:
*/
VariantDataMap *variantMap() { return &m_variantData; }
- double dataDouble( const QString & id ) const;
- int dataInt( const QString & id ) const;
- bool dataBool( const QString & id ) const;
- QString dataString( const QString & id ) const;
- QColor dataColor( const QString & id ) const;
+ double dataDouble( const TQString & id ) const;
+ int dataInt( const TQString & id ) const;
+ bool dataBool( const TQString & id ) const;
+ TQString dataString( const TQString & id ) const;
+ TQColor dataColor( const TQString & id ) const;
- virtual Variant * createProperty( const QString & id, Variant::Type::Value type );
- Variant * property( const QString & id ) const;
- bool hasProperty( const QString & id ) const;
+ virtual Variant * createProperty( const TQString & id, Variant::Type::Value type );
+ Variant * property( const TQString & id ) const;
+ bool hasProperty( const TQString & id ) const;
/**
* Whether or not we can rotate the item
@@ -86,8 +87,8 @@ public:
/**
* Returns a identifier for the CNItem, which is unique on the ICNDocument
*/
- QString id() const { return m_id; }
- QString type() const { return m_type; }
+ TQString id() const { return m_id; }
+ TQString type() const { return m_type; }
/**
* Called from ItemLibrary after this class and subclasses have finished
* constructing themselves.
@@ -105,17 +106,17 @@ public:
void setChanged();
/**
* Sets this item as a child of the given item. Calls reparented with the
- * old and the new parent.
+ * old and the new tqparent.
*/
- void setParentItem( Item *parentItem );
+ void setParentItem( Item *tqparentItem );
/**
- * The parent item for this item, or NULL if none
+ * The tqparent item for this item, or NULL if none
*/
- Item *parentItem() const { return p_parentItem; }
+ Item *tqparentItem() const { return p_parentItem; }
ItemDocument *itemDocument() const { return p_itemDocument; }
/**
* Returns the number of items away from the top item this is
- * (parent-wise). Returns 0 if has no parent.
+ * (tqparent-wise). Returns 0 if has no tqparent.
*/
int level() const;
/**
@@ -129,7 +130,7 @@ public:
bool isRaised() const { return m_bIsRaised; }
/**
* Sets this item to the given baseZ level, and calls this function for the
- * children with baseZ incremented by one. Reinherit this function to set
+ * tqchildren with baseZ incremented by one. Reinherit this function to set
* the Z of attached stuff (such as nodes).
*/
virtual void updateZ( int baseZ );
@@ -142,37 +143,37 @@ public:
*/
void addChild( Item *child );
/**
- * Returns the list of children.
+ * Returns the list of tqchildren.
* @param if includeGrandChildren is true then this list will also contain
- * the children's children, and so on recursively, instead of just the
- * immediate children.
+ * the tqchildren's tqchildren, and so on recursively, instead of just the
+ * immediate tqchildren.
*/
- ItemList children( bool includeGrandChildren = false ) const;
+ ItemList tqchildren( bool includeGrandChildren = false ) const;
/**
* Returns whether we have the given child as either a direct child, or as
* either a direct or indirect child
*/
- bool contains( Item *item, bool direct = false ) const;
+ bool tqcontains( Item *item, bool direct = false ) const;
/**
* Calls prePresize with the bounds, and if that returns true, sets
* m_sizeRect to the given rect, and then calls postResize.
* @param forceItemPoints if true, will set the item points to a rectangle of the given size
*/
- void setSize( QRect sizeRect, bool forceItemPoints = false );
+ void setSize( TQRect sizeRect, bool forceItemPoints = false );
/**
* Convenience function.
- * @see setSize( QRect sizeRect, bool forceItemPoints );
+ * @see setSize( TQRect sizeRect, bool forceItemPoints );
*/
- void setSize( int x, int y, int w, int h, bool forceItemPoints = false ) { setSize( QRect(x,y,w,h), forceItemPoints ); }
+ void setSize( int x, int y, int w, int h, bool forceItemPoints = false ) { setSize( TQRect(x,y,w,h), forceItemPoints ); }
/**
* @returns the m_sizeRect rectangble that contains the item points
*/
- QRect sizeRect() const { return m_sizeRect; }
+ TQRect sizeRect() const { return m_sizeRect; }
/**
* Reinherit this function if you want to determine what the minimum size is
* that this item can be resized to.
*/
- virtual QSize minimumSize() const { return QSize(0,0); }
+ virtual TQSize tqminimumSize() const { return TQSize(0,0); }
int offsetX() const { return m_sizeRect.x(); }
int offsetY() const { return m_sizeRect.y(); }
int width() const { return m_sizeRect.width(); }
@@ -187,11 +188,11 @@ public:
/**
* Returns the name of the CNItem, e.g. "Resistor"
*/
- QString name() const { return m_name; }
+ TQString name() const { return m_name; }
/**
* Returns a description of the CNItem, with html tags if appropriate.
*/
- QString description() const { return m_desc; }
+ TQString description() const { return m_desc; }
/**
* Modifies the exponent of the number so that it appears readable:
* eg 10000->10, 174822->175, 0.6->600, etc
@@ -201,7 +202,7 @@ public:
* Returns the SI exponent of the number as a letter:
* eg 10000 returns 'k', 0.6 returns 'm', etc
*/
- static QString getNumberMag( double num );
+ static TQString getNumberMag( double num );
/**
* Returns the multiplier required to get the num up to human readable form:
* eg 10000 returns 0.001, etc
@@ -212,12 +213,12 @@ public:
* to its actual value based on the SI exponent:
* eg 'm' returns 0.001, etc
*/
- static double getMultiplier( const QString &mag );
+ static double getMultiplier( const TQString &mag );
virtual ItemData itemData() const;
virtual void restoreFromItemData( const ItemData &itemData );
- const QFont & font() const { return m_font; }
+ const TQFont & font() const { return m_font; }
public slots:
virtual void removeItem();
@@ -258,17 +259,17 @@ protected slots:
protected:
/**
- * Reinherit this function if you want to do anything with children. Called
- * after the parent is changed, with the old parent and the new parent.
+ * Reinherit this function if you want to do anything with tqchildren. Called
+ * after the tqparent is changed, with the old tqparent and the new tqparent.
*/
virtual void reparented( Item */*oldParent*/, Item */*newParent*/ ) {};
/**
- * Reinherit this function if you want to do anything with children. Called
+ * Reinherit this function if you want to do anything with tqchildren. Called
* after a child has been added.
*/
virtual void childAdded( Item * ) {};
/**
- * Reinherit this function if you want to do anything with children. Called
+ * Reinherit this function if you want to do anything with tqchildren. Called
* after a child has been removed.
*/
virtual void childRemoved( Item * ) {};
@@ -276,22 +277,22 @@ protected:
* Set the rough bounding points for this item. Calls itemPointsChanged
* after setting the points
*/
- void setItemPoints( const QPointArray &pa, bool setSizeFromPoints = true );
+ void setItemPoints( const TQPointArray &pa, bool setSizeFromPoints = true );
/**
* Reinherit this function if you want to apply any sort of transformation
* to the item points
*/
virtual void itemPointsChanged();
- virtual bool preResize( QRect sizeRect ) { Q_UNUSED(sizeRect); return true; }
+ virtual bool preResize( TQRect sizeRect ) { Q_UNUSED(sizeRect); return true; }
virtual void postResize() {};
- QString m_id;
- QString m_name, m_desc; // Name and description
- QString m_type;
- GuardedItem p_parentItem; // If attached to a parent item
- ItemList m_children;
- QGuardedPtr<ItemDocument> p_itemDocument;
- QPointArray m_itemPoints; // The unorientated and unsized item points
+ TQString m_id;
+ TQString m_name, m_desc; // Name and description
+ TQString m_type;
+ GuardedItem p_parentItem; // If attached to a tqparent item
+ ItemList m_tqchildren;
+ TQGuardedPtr<ItemDocument> p_itemDocument;
+ TQPointArray m_itemPoints; // The unorientated and unsized item points
friend class ItemLibrary;
@@ -300,8 +301,8 @@ protected:
bool m_bDoneCreation;
bool b_deleted;
bool m_bDynamicContent;
- QFont m_font;
- QRect m_sizeRect;
+ TQFont m_font;
+ TQRect m_sizeRect;
VariantDataMap m_variantData;
};