00001 /*************************************************************************** 00002 * testobject.h 00003 * This file is part of the KDE project 00004 * copyright (C)2004-2005 by Sebastian Sauer (mail@dipe.org) 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Library General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; see the file COPYING. If not, write to 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 ***************************************************************************/ 00019 00020 #ifndef KROSS_TEST_TESTOBJECT_H 00021 #define KROSS_TEST_TESTOBJECT_H 00022 00023 #include <QObject> 00024 #include <QString> 00025 #include <QStringList> 00026 #include <QVariant> 00027 #include <QMetaType> 00028 00029 #include <kdebug.h> 00030 00032 class TestObject : public QObject 00033 { 00034 Q_OBJECT 00035 00036 Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty) 00037 Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty) 00038 Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty) 00039 Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty) 00040 Q_PROPERTY(QStringList stringListProperty READ stringListProperty WRITE setStringListProperty) 00041 Q_PROPERTY(QVariantList listProperty READ listProperty WRITE setListProperty) 00042 00043 Q_ENUMS(TestEnum) 00044 00045 public: 00046 TestObject(); 00047 TestObject(const QString& name); 00048 TestObject(const TestObject& obj); 00049 virtual ~TestObject(); 00050 00051 enum TestEnum { TESTENUM1 = 1, TESTENUM2 = 2, TESTENUM3 = 4, TESTENUM4 = 8 }; 00052 00053 private: 00054 00055 bool m_boolproperty; 00056 bool boolProperty() const { return m_boolproperty; } 00057 void setBoolProperty(bool prop) { m_boolproperty = prop; } 00058 00059 int m_intproperty; 00060 int intProperty() const { return m_intproperty; } 00061 void setIntProperty(int prop) { m_intproperty = prop; } 00062 00063 double m_doubleproperty; 00064 double doubleProperty() const { return m_doubleproperty; } 00065 void setDoubleProperty(double prop) { m_doubleproperty = prop; } 00066 00067 QString m_stringproperty; 00068 QString stringProperty() const { return m_stringproperty; } 00069 void setStringProperty(QString prop) { m_stringproperty = prop; } 00070 00071 QStringList m_stringlistproperty; 00072 QStringList stringListProperty() const { return m_stringlistproperty; } 00073 void setStringListProperty(QStringList prop) { m_stringlistproperty = prop; } 00074 00075 QVariantList m_listproperty; 00076 QVariantList listProperty() const { return m_listproperty; } 00077 void setListProperty(QVariantList prop) { m_listproperty = prop; } 00078 00079 signals: 00080 void signalVoid(); 00081 void signalBool(bool); 00082 void signalInt(int); 00083 void signalString(const QString&); 00084 00085 public slots: 00086 00087 // return the objectname 00088 QString name(); 00089 00090 // test the enumerator 00091 //TestEnum testEnum(TestEnum e) const { return e; } 00092 00093 // to test basic datatypes 00094 int func_int_int(int); 00095 bool func_bool_bool(bool); 00096 uint func_uint_uint(uint); 00097 double func_double_double(double); 00098 qlonglong func_qlonglong_qlonglong(qlonglong); 00099 qulonglong func_qulonglong_qulonglong(qulonglong); 00100 QByteArray func_qbytearray_qbytearray(QByteArray); 00101 QString func_qstring_qstring(const QString&); 00102 QStringList func_qstringlist_qstringlist(QStringList); 00103 QVariantList func_qvariantlist_qvariantlist(QVariantList); 00104 QVariantMap func_qvariantmap_qvariantmap(QVariantMap); 00105 QVariant func_qvariant_qvariant(const QVariant&); 00106 00107 // for misc tests 00108 void func_void(); 00109 void func_void_int(int); 00110 void func_void_qstring_int(QString,int); 00111 void func_void_qstringlist(QStringList); 00112 QString func_qstring_qstring_int(QString,int); 00113 00114 // Kross::Object 00115 //void func_void_krossobject(Kross::Object::Ptr); 00116 //Kross::Object::Ptr func_krossobject_krossobject(Kross::Object::Ptr); 00117 00118 // QObject 00119 void func_void_qobject(QObject*); 00120 QObject* func_qobject_qobject(QObject*); 00121 00122 // TestObject 00123 void func_void_testobject(TestObject*); 00124 TestObject* func_testobject_testobject(TestObject*); 00125 00126 //QObject* self() { return this; } 00127 }; 00128 00129 Q_DECLARE_METATYPE( TestObject* ) 00130 00131 #endif