From 74d7a64994b02e7d880f4e9960f653b2510d48d8 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 25 Sep 2023 13:59:20 +0900 Subject: Replace QObject, QWidget, QImage, QPair, QRgb, QColor, QChar, QString, QIODevice with TQ* version Signed-off-by: Michele Calgaro (cherry picked from commit 0580616e20b68c764cdbbd9a01c9dd21f99766d4) --- doc/kommander/extending.docbook | 48 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'doc/kommander/extending.docbook') diff --git a/doc/kommander/extending.docbook b/doc/kommander/extending.docbook index 353390ca..8006bdef 100644 --- a/doc/kommander/extending.docbook +++ b/doc/kommander/extending.docbook @@ -63,31 +63,31 @@ class KomLineEdit : public KLineEdit, public KommanderWidget { TQ_OBJECT - TQ_PROPERTY(QString populationText READ populationText WRITE setPopulationText DESIGNABLE false) + TQ_PROPERTY(TQString populationText READ populationText WRITE setPopulationText DESIGNABLE false) TQ_PROPERTY(QStringList associations READ associatedText WRITE setAssociatedText DESIGNABLE false) TQ_PROPERTY(bool KommanderWidget READ isKommanderWidget) public: - KomLineEdit(QWidget *a_parent, const char *a_name); + KomLineEdit(TQWidget *a_parent, const char *a_name); ~KomLineEdit(); - virtual QString widgetText() const; + virtual TQString widgetText() const; virtual bool isKommanderWidget() const; virtual void setAssociatedText(const QStringList&); virtual QStringList associatedText() const; - virtual QString currentState() const; + virtual TQString currentState() const; - virtual QString populationText() const; - virtual void setPopulationText(const QString&); + virtual TQString populationText() const; + virtual void setPopulationText(const TQString&); public slots: - virtual void setWidgetText(const QString &); + virtual void setWidgetText(const TQString &); virtual void populate(); protected: void showEvent( QShowEvent *e ); signals: void widgetOpened(); - void widgetTextChanged(const QString &); + void widgetTextChanged(const TQString &); }; Most of this is just template code that you don't need to worry about. @@ -99,7 +99,7 @@ widget we wish to integrate with &kommander;, and secondly from KommanderWidget. There are a few parts in the cpp file that are important to each particular widget. -KomLineEdit::KomLineEdit(QWidget *a_parent, const char *a_name) +KomLineEdit::KomLineEdit(TQWidget *a_parent, const char *a_name) : KLineEdit(a_parent, a_name), KommanderWidget(this) { QStringList states; @@ -115,9 +115,9 @@ that had different kinds of states, such as a check box, you might set three states unchecked, semichecked and checked here. -QString KomLineEdit::currentState() const +TQString KomLineEdit::currentState() const { - return QString("default"); + return TQString("default"); } We set the states in the constructor above, and this just returns the current state of the widget. For our widget @@ -126,12 +126,12 @@ that checks what state your widget is currently in and return the appropriate string here. -QString KomLineEdit::widgetText() const +TQString KomLineEdit::widgetText() const { return KLineEdit::text(); } -void KomLineEdit::setWidgetText(const QString &a_text) +void KomLineEdit::setWidgetText(const TQString &a_text) { KLineEdit::setText(a_text); emit widgetTextChanged(a_text); @@ -139,7 +139,7 @@ void KomLineEdit::setWidgetText(const QString &a_text) These are the two most important methods, where the bulk of the functional code goes. -QString KomLineEdit::widgetText() const method returns the widget text of the +TQString KomLineEdit::widgetText() const method returns the widget text of the widget (the text that the @widgetText special is expanded to in text associations). For our widget, the widget text is simply the text inside the line edit, so we just return that. Similarly when setting the widget text, @@ -162,17 +162,17 @@ enum Functions { Function2, LastFunction }; -KomLineEdit::KomLineEdit(QWidget *a_parent, const char *a_name) +KomLineEdit::KomLineEdit(TQWidget *a_parent, const char *a_name) : KLineEdit(a_parent, a_name), KommanderWidget(this) { ... //code like described above KommanderPlugin::setDefaultGroup(Group::DCOP); - KommanderPlugin::registerFunction(Function1, "function1(QString widget, QString arg1, int arg2)", i18n("Call function1 with two arguments, second is optional."), 2, 3); - KommanderPlugin::registerFunction(function2, "function2(QString widget)", i18n("Get a QString as a result of function2."), 1); + KommanderPlugin::registerFunction(Function1, "function1(TQString widget, TQString arg1, int arg2)", i18n("Call function1 with two arguments, second is optional."), 2, 3); + KommanderPlugin::registerFunction(function2, "function2(TQString widget)", i18n("Get a TQString as a result of function2."), 1); } This registers two functions: function1 and function2. The number assigned to the functions (here 1160 and 1161) must be unique, not used in any other plugin or -inside &kommander;. function1 takes two arguments, one is optional, function2 takes no argument and returns a string. The QString widget argument in the signatures notes that this functions work on a widget, like: KomLineEdit.function1("foo", 1). +inside &kommander;. function1 takes two arguments, one is optional, function2 takes no argument and returns a string. The TQString widget argument in the signatures notes that this functions work on a widget, like: KomLineEdit.function1("foo", 1). To teach &kommander; that the widget supports these functions, add a method like this: @@ -187,7 +187,7 @@ function. The function code should be handled inside the handleDCOP method: -QString KomLineEdit::handleDCOP(int function, const QStringList& args) +TQString KomLineEdit::handleDCOP(int function, const QStringList& args) { switch (function) { @@ -203,7 +203,7 @@ QString KomLineEdit::handleDCOP(int function, const QStringList& args) default: return KommanderWidget::handleDCOP(function, args); } - return QString::null; + return TQString::null; } There are cases when the widget should appear differently in the editor than in @@ -226,7 +226,7 @@ derive from QLabel, and use this in the constructor: functions, like in the execute function. Here is an example from the AboutDialog widget: -QString AboutDialog::handleDCOP(int function, const QStringList& args) +TQString AboutDialog::handleDCOP(int function, const QStringList& args) { switch (function) { ... @@ -287,7 +287,7 @@ class MyKomPlugin : public KommanderPlugin { public: MyKomPlugin(); - virtual QWidget *create( const QString &className, QWidget *parent = 0, const char *name = 0 ); + virtual TQWidget *create( const TQString &className, TQWidget *parent = 0, const char *name = 0 ); }; @@ -313,7 +313,7 @@ etc. Regarding the icon, the above example loads a medium sized icon called iconname from the standard &kde; icon location. -QWidget *MyKomPlugin::create( const QString &className, QWidget *parent, const char *name ) +TQWidget *MyKomPlugin::create( const TQString &className, TQWidget *parent, const char *name ) { if( className == "KomLineEdit" ) return new KomLineEdit( parent, name ); @@ -410,7 +410,7 @@ You need to add to the editor/widgetfactory.cpp as well: ... #include "mywidget.h" ... -QWidget *WidgetFactory::createWidget( const QString &className, QWidget *parent, const char *name, bool init, +TQWidget *WidgetFactory::createWidget( const TQString &className, TQWidget *parent, const char *name, bool init, const QRect *r, Qt::Orientation orient ) { ... -- cgit v1.2.1