summaryrefslogtreecommitdiffstats
path: root/kexi/formeditor/widgetfactory.h
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/formeditor/widgetfactory.h')
-rw-r--r--kexi/formeditor/widgetfactory.h241
1 files changed, 121 insertions, 120 deletions
diff --git a/kexi/formeditor/widgetfactory.h b/kexi/formeditor/widgetfactory.h
index 43736ebcd..2cb74fc8d 100644
--- a/kexi/formeditor/widgetfactory.h
+++ b/kexi/formeditor/widgetfactory.h
@@ -23,23 +23,23 @@
#define KFORMDESIGNERWIDGETFACTORY_H
-#include <qobject.h>
-#include <qguardedptr.h>
-#include <qpixmap.h>
-#include <qpopupmenu.h>
-#include <qasciidict.h>
+#include <tqobject.h>
+#include <tqguardedptr.h>
+#include <tqpixmap.h>
+#include <tqpopupmenu.h>
+#include <tqasciidict.h>
#include <kexiutils/tristate.h>
-// class QPixmap;
-template<class type> class QValueVector;
-template<class type> class QPtrList;
-template<class type> class QDict;
-class QWidget;
-class QDomElement;
-class QDomDocument;
-class QVariant;
-class QListView;
+// class TQPixmap;
+template<class type> class TQValueVector;
+template<class type> class TQPtrList;
+template<class type> class TQDict;
+class TQWidget;
+class TQDomElement;
+class TQDomDocument;
+class TQVariant;
+class TQListView;
class KActionCollection;
class KTextEdit;
class KLineEdit;
@@ -65,49 +65,49 @@ class Form;
class KFORMEDITOR_EXPORT WidgetInfo
{
public:
- typedef QPtrList<WidgetInfo> List;
- typedef QAsciiDict<WidgetInfo> Dict;
+ typedef TQPtrList<WidgetInfo> List;
+ typedef TQAsciiDict<WidgetInfo> Dict;
WidgetInfo(WidgetFactory *f);
- WidgetInfo(WidgetFactory *f, const char* parentFactoryName, const char* inheritedClassName = 0);
+ WidgetInfo(WidgetFactory *f, const char* tqparentFactoryName, const char* inheritedClassName = 0);
virtual ~WidgetInfo();
//! \return a pixmap associated with the widget
- QString pixmap() const { return m_pixmap; }
+ TQString pixmap() const { return m_pixmap; }
- //! \return the class name of a widget e.g. 'QLineEdit'
- QCString className() const { return m_class; }
+ //! \return the class name of a widget e.g. 'TQLineEdit'
+ TQCString className() const { return m_class; }
/*! \return the name used to name widget, that will appear eg in scripts (must not contain spaces
nor non-latin1 characters) */
- QString namePrefix() const { return m_prefixName; }
+ TQString namePrefix() const { return m_prefixName; }
//! \return the real name e.g. 'Line Edit', showed eg in ObjectTreeView
- QString name() const { return m_name; }
+ TQString name() const { return m_name; }
- QString description() const { return m_desc; }
- QString includeFileName() const { return m_include; }
- QValueList<QCString> alternateClassNames() const { return m_alternateNames; }
- QString savingName() const { return m_saveName; }
+ TQString description() const { return m_desc; }
+ TQString includeFileName() const { return m_include; }
+ TQValueList<TQCString> alternateClassNames() const { return m_alternateNames; }
+ TQString savingName() const { return m_saveName; }
WidgetFactory *factory() const { return m_factory; }
- void setPixmap(const QString &p) { m_pixmap = p; }
- void setClassName(const QCString &s) { m_class = s; }
- void setName(const QString &n) { m_name = n; }
- void setNamePrefix(const QString &n) { m_prefixName = n; }
- void setDescription(const QString &desc) { m_desc = desc;}
+ void setPixmap(const TQString &p) { m_pixmap = p; }
+ void setClassName(const TQCString &s) { m_class = s; }
+ void setName(const TQString &n) { m_name = n; }
+ void setNamePrefix(const TQString &n) { m_prefixName = n; }
+ void setDescription(const TQString &desc) { m_desc = desc;}
/*! Sets the C++ include file corresponding to this class,
- that uic will need to add when creating the file. You don't have to set this for Qt std widgets.*/
- void setIncludeFileName(const QString &name) { m_include = name;}
+ that uic will need to add when creating the file. You don't have to set this for TQt std widgets.*/
+ void setIncludeFileName(const TQString &name) { m_include = name;}
/*! Sets alternate names for this class.
If this name is found when loading a .ui file, the className() will be used instead.
- It allows to support both KDE and Qt versions of widget, without duplicating code.
+ It allows to support both KDE and TQt versions of widget, without duplicating code.
As a rule, className() should always return a class name which is inherited from
- alternate class. For example KListView class has alternate QListView class.
+ alternate class. For example KListView class has alternate TQListView class.
\a override parameter overrides class name of a widget,
even if it was implemented in other factory.
@@ -119,21 +119,21 @@ class KFORMEDITOR_EXPORT WidgetInfo
For example, in Kexi application, KLineEdit class contains additional
"datasource" property for binding to database sources.
*/
- void addAlternateClassName(const QCString& alternateName, bool override = false);
+ void addAlternateClassName(const TQCString& alternateName, bool override = false);
/*! \return true is a class \a alternateName is defined as alternate name with
'override' flag set to true, using addAlternateClassName().
If this flag is set to false (the default) or there's no such alternate class
name defined. */
- bool isOverriddenClassName(const QCString& alternateName) const;
+ bool isOverriddenClassName(const TQCString& alternateName) const;
/*! Sets the name that will be written in the .ui file when saving.
This name must be one of alternate names (or loading will be impossible).
On form data saving to XML .ui format, saveName is used instead,
- so .ui format is not broken and still usable with other software as Qt Designer.
+ so .ui format is not broken and still usable with other software as TQt Designer.
Custom properties are saved as well with 'stdset' attribute set to 0. */
- void setSavingName(const QString &saveName) { m_saveName = saveName; }
+ void setSavingName(const TQString &saveName) { m_saveName = saveName; }
/*! Sets autoSync flag for property \a propertyName.
This allows to override autoSync flag for certain widget's property, because
@@ -146,7 +146,7 @@ class KFORMEDITOR_EXPORT WidgetInfo
If cancelled value is returned, there is no overriding (the default). */
tristate autoSyncForProperty(const char *propertyName) const;
- QCString parentFactoryName() const { return m_parentFactoryName; }
+ TQCString tqparentFactoryName() const { return m_parentFactoryName; }
WidgetInfo* inheritedClass() const { return m_inheritedClass; }
@@ -161,22 +161,22 @@ class KFORMEDITOR_EXPORT WidgetInfo
int customTypeForProperty(const char *propertyName) const;
protected:
- QCString m_parentFactoryName, m_inheritedClassName; //!< Used for inheriting widgets between factories
+ TQCString m_parentFactoryName, m_inheritedClassName; //!< Used for inheriting widgets between factories
WidgetInfo* m_inheritedClass;
private:
- QString m_pixmap;
- QCString m_class;
- QString m_name;
- QString m_prefixName;
- QString m_desc;
- QString m_include;
- QValueList<QCString> m_alternateNames;
- QAsciiDict<char> *m_overriddenAlternateNames;
- QString m_saveName;
- QGuardedPtr<WidgetFactory> m_factory;
- QAsciiDict<char> *m_propertiesWithDisabledAutoSync;
- QMap<QCString,int> *m_customTypesForProperty;
+ TQString m_pixmap;
+ TQCString m_class;
+ TQString m_name;
+ TQString m_prefixName;
+ TQString m_desc;
+ TQString m_include;
+ TQValueList<TQCString> m_alternateNames;
+ TQAsciiDict<char> *m_overriddenAlternateNames;
+ TQString m_saveName;
+ TQGuardedPtr<WidgetFactory> m_factory;
+ TQAsciiDict<char> *m_propertiesWithDisabledAutoSync;
+ TQMap<TQCString,int> *m_customTypesForProperty;
friend class WidgetLibrary;
};
@@ -198,7 +198,7 @@ class KFORMEDITOR_EXPORT WidgetInfo
You can also choose which properties to show in the Property Editor.
By default, most all properties are shown (see implementation for details),
but you can hide some reimplementing isPropertyVisibleInternal() (don't forget to call superclass' method)
- To add new properties, just define new Q_PROPERTY in widget class definition.\n \n
+ To add new properties, just define new TQ_PROPERTY in widget class definition.\n \n
<b>Inline editing</b>\n
KFormDesigner allow you to edit the widget's contents inside Form, without using a dialog.
@@ -218,12 +218,12 @@ class KFORMEDITOR_EXPORT WidgetInfo
<b>Widget saving/loading</b>\n
You can also control how your widget are saved/loaded. You can choose which properties to save
(see autoSaveProperties()), and save/load custom properties, ie
- properties that are not Q_PROPERTY but you want to save in the UI file. This is used eg to
+ properties that are not TQ_PROPERTY but you want to save in the UI file. This is used eg to
save combo box or listview contents (see saveSpecialProperty() and
readSpecialProperty()). \n \n
<b>Special internal properties</b>\n
- Use void setInternalProperty(const QCString& classname, const QCString& property, const QString& value);
+ Use void setInternalProperty(const TQCString& classname, const TQCString& property, const TQString& value);
to set values of special internal properties.
Currently these properties are used for customizing popup menu items used for orientation selection.
Customization for class ClassName should look like:
@@ -236,10 +236,10 @@ class KFORMEDITOR_EXPORT WidgetInfo
* "orientationSelectionPopup:verticalIcon" - the same for "Vertical" item.
Set this property only for classes supporting orientations.
* "orientationSelectionPopup:horizontalText" - sets a i18n'd text for "Horizontal" item
- for objects of class 'ClassName', e.g. i18n("Insert Horizontal Line").
+ for objects of class 'ClassName', e.g. i18n("InsertQt::Horizontal Line").
Set this property only for classes supporting orientations.
* "orientationSelectionPopup:verticalText" - the same for "Vertical" item,
- e.g. i18n("Insert Vertical Line"). Set this property only for classes supporting orientations.
+ e.g. i18n("InsertQt::Vertical Line"). Set this property only for classes supporting orientations.
* "dontStartEditingOnInserting" - if not empty, WidgetFactory::startEditing() will not be executed upon
widget inseting by a user.
* "forceShowAdvancedProperty:{propertyname}" - set it to "1" for "{propertyname}" advanced property
@@ -254,9 +254,10 @@ class KFORMEDITOR_EXPORT WidgetInfo
See the standard factories in formeditor/factories for an example of factories,
and how to deal with complex widgets (eg tabwidget).
*/
-class KFORMEDITOR_EXPORT WidgetFactory : public QObject
+class KFORMEDITOR_EXPORT WidgetFactory : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
//! Options used in createWidget()
enum CreateWidgetOptions {
@@ -267,7 +268,7 @@ class KFORMEDITOR_EXPORT WidgetFactory : public QObject
DefaultOptions = AnyOrientation | DesignViewMode
};
- WidgetFactory(QObject *parent=0, const char *name=0);
+ WidgetFactory(TQObject *tqparent=0, const char *name=0);
virtual ~WidgetFactory();
/*! Adds a new class described by \a w. */
@@ -288,12 +289,12 @@ class KFORMEDITOR_EXPORT WidgetFactory : public QObject
* Creates a widget (and if needed a KFormDesigner::Container)
* \return the created widget
* \param classname the classname of the widget, which should get created
- * \param parent the parent for the created widget
+ * \param tqparent the tqparent for the created widget
* \param name the name of the created widget
* \param container the toplevel Container (if a container should get created)
* \param options options for the created widget: orientation and view mode (see CreateWidgetOptions)
*/
- virtual QWidget* createWidget(const QCString &classname, QWidget *parent, const char *name,
+ virtual TQWidget* createWidget(const TQCString &classname, TQWidget *tqparent, const char *name,
KFormDesigner::Container *container,
int options = DefaultOptions) = 0;
@@ -303,69 +304,69 @@ class KFORMEDITOR_EXPORT WidgetFactory : public QObject
/*! This function can be used to add custom items in widget \a w context
menu \a menu. */
- virtual bool createMenuActions(const QCString &classname, QWidget *w, QPopupMenu *menu,
+ virtual bool createMenuActions(const TQCString &classname, TQWidget *w, TQPopupMenu *menu,
KFormDesigner::Container *container)=0;
/*! Creates (if necessary) an editor to edit the contents of the widget directly in the Form
(eg creates a line edit to change the text of a label). \a classname is
the class the widget belongs to, \a w is the widget to edit
- and \a container is the parent container of this widget (to access Form etc.).
+ and \a container is the tqparent container of this widget (to access Form etc.).
*/
- virtual bool startEditing(const QCString &classname, QWidget *w, Container *container)=0;
+ virtual bool startEditing(const TQCString &classname, TQWidget *w, Container *container)=0;
/*! This function is called just before the Form is previewed. It allows widgets
to make changes before switching (ie for a Spring, hiding the cross) */
- virtual bool previewWidget(const QCString &classname, QWidget *widget, Container *container)=0;
+ virtual bool previewWidget(const TQCString &classname, TQWidget *widget, Container *container)=0;
- virtual bool clearWidgetContent(const QCString &classname, QWidget *w);
+ virtual bool clearWidgetContent(const TQCString &classname, TQWidget *w);
/*! This function is called when FormIO finds a property, at save time,
that it cannot handle (ie not a normal property).
This way you can save special properties, for example the contents of a listbox.
\sa readSpecialProperty()
*/
- virtual bool saveSpecialProperty(const QCString &classname, const QString &name,
- const QVariant &value, QWidget *w,
- QDomElement &parentNode, QDomDocument &parent);
+ virtual bool saveSpecialProperty(const TQCString &classname, const TQString &name,
+ const TQVariant &value, TQWidget *w,
+ TQDomElement &tqparentNode, TQDomDocument &tqparent);
/*! This function is called when FormIO finds a property or an unknown
element in a .ui file. You can this way load a special property, for
example the contents of a listbox.
\sa saveSpecialProperty()
*/
- virtual bool readSpecialProperty(const QCString &classname, QDomElement &node,
- QWidget *w, ObjectTreeItem *item);
+ virtual bool readSpecialProperty(const TQCString &classname, TQDomElement &node,
+ TQWidget *w, ObjectTreeItem *item);
/*! This function is used to know whether the \a property for the widget \a w
should be shown or not in the PropertyEditor. If \a multiple is true,
then multiple widgets of the same class are selected, and you should
only show properties shared by widgets (eg font, color). By default,
all properties are shown if multiple == true, and none if multiple == false. */
- bool isPropertyVisible(const QCString &classname, QWidget *w,
- const QCString &property, bool multiple, bool isTopLevel);
+ bool isPropertyVisible(const TQCString &classname, TQWidget *w,
+ const TQCString &property, bool multiple, bool isTopLevel);
/*! You need to return here a list of the properties that should automatically be saved
for a widget belonging to \a classname, and your custom properties (eg "text"
for label or button, "contents" for combobox...). */
- virtual QValueList<QCString> autoSaveProperties(const QCString &classname)=0;
+ virtual TQValueList<TQCString> autoSaveProperties(const TQCString &classname)=0;
/*! \return The i18n'ed name of the property whose name is \a name,
that will be displayed in PropertyEditor. */
- inline QString propertyDescForName(const QCString &name) { return m_propDesc[name]; };
+ inline TQString propertyDescForName(const TQCString &name) { return m_propDesc[name]; };
/*! \return The i18n'ed name of the property's value whose name is \a name. */
- inline QString propertyDescForValue(const QCString &name) { return m_propValDesc[name]; };
+ inline TQString propertyDescForValue(const TQCString &name) { return m_propValDesc[name]; };
/*! This method is called after WidgetPropertySet was filled with properties
of a widget \a w, of class defined by \a info.
Default implementation does nothing.
Implement this if you need to set options for properties within the set \a buf. */
- virtual void setPropertyOptions( WidgetPropertySet& buf, const WidgetInfo& info, QWidget *w );
+ virtual void setPropertyOptions( WidgetPropertySet& buf, const WidgetInfo& info, TQWidget *w );
/*! \return internal property \a property for a class \a classname.
Internal properties are not stored within objects, but can be just provided
to describe classes' details. */
- inline QString internalProperty(const QCString& classname, const QCString& property) const {
+ inline TQString internalProperty(const TQCString& classname, const TQCString& property) const {
return m_internalProp[classname+":"+property];
}
@@ -373,62 +374,62 @@ class KFORMEDITOR_EXPORT WidgetFactory : public QObject
/*! This function is called when we want to know whether the property should be visible.
Implement it in the factory; don't forget to call implementation in the superclass.
Default implementation hides "caption", "icon", "sizeIncrement" and "iconText" properties. */
- virtual bool isPropertyVisibleInternal(const QCString &classname, QWidget *w,
- const QCString &property, bool isTopLevel);
+ virtual bool isPropertyVisibleInternal(const TQCString &classname, TQWidget *w,
+ const TQCString &property, bool isTopLevel);
/*! Sometimes property sets should be reloaded when a given property value changed.
Implement it in the factory. Default implementation always returns false. */
- virtual bool propertySetShouldBeReloadedAfterPropertyChange(const QCString& classname, QWidget *w,
- const QCString& property);
+ virtual bool propertySetShouldBeReloadedAfterPropertyChange(const TQCString& classname, TQWidget *w,
+ const TQCString& property);
/*! This function creates a KLineEdit to input some text and edit a widget's contents.
This can be used in startEditing(). \a text is the text to display by default
- in the line edit, \a w is the edited widget, \a geometry is the geometry the new line
- edit should have, and \a align is Qt::AlignmentFlags of the new line edit. */
- void createEditor(const QCString &classname, const QString &text,
- QWidget *w, Container *container, QRect geometry,
+ in the line edit, \a w is the edited widget, \a tqgeometry is the tqgeometry the new line
+ edit should have, and \a align is TQt::AlignmentFlags of the new line edit. */
+ void createEditor(const TQCString &classname, const TQString &text,
+ TQWidget *w, Container *container, TQRect tqgeometry,
int align, bool useFrame=false, bool multiLine = false,
- BackgroundMode background = Qt::NoBackground);
+ BackgroundMode background = TQt::NoBackground);
/*! This function provides a simple editing mode : it justs disable event filtering
for the widget, and it install it again when
the widget loose focus or Enter is pressed.
*/
- void disableFilter(QWidget *w, Container *container);
+ void disableFilter(TQWidget *w, Container *container);
/*! This function creates a little dialog (a KEditListBox) to modify the contents
of a list (of strings). It can be used to modify the contents
of a combo box for instance. The modified list is copied
into \a list when the user presses "Ok".*/
- bool editList(QWidget *w, QStringList &list);
+ bool editList(TQWidget *w, TQStringList &list);
- /*! This function creates a little editor to modify rich text. It supports alignment,
+ /*! This function creates a little editor to modify rich text. It supports tqalignment,
subscript and superscript and all basic formatting properties.
If the user presses "Ok", the edited text is put in \a text.
If he presses "Cancel", nothing happens. */
- bool editRichText(QWidget *w, QString &text);
+ bool editRichText(TQWidget *w, TQString &text);
/*! This function creates a dialog to modify the contents of a ListView. You can modify both
columns and list items. The listview is automatically updated if the user presses "Ok".*/
- void editListView(QListView *listview);
+ void editListView(TQListView *listview);
/*! This function destroys the editor when it loses focus or Enter is pressed. */
- virtual bool eventFilter(QObject *obj, QEvent *ev);
+ virtual bool eventFilter(TQObject *obj, TQEvent *ev);
/*! This function is used to modify a property of a widget (eg after editing it).
Please use it instead of w->setProperty() to allow sync inside PropertyEditor.
*/
- void changeProperty(const char *name, const QVariant &value, Form *form);
+ void changeProperty(const char *name, const TQVariant &value, Form *form);
/*! This function is called when the widget is resized,
and the \a editor size needs to be updated. */
- virtual void resizeEditor(QWidget *editor, QWidget *widget, const QCString &classname);
+ virtual void resizeEditor(TQWidget *editor, TQWidget *widget, const TQCString &classname);
// /*! Adds the i18n'ed description of a property, which will be shown in PropertyEditor. */
-// void addPropertyDescription(Container *container, const char *prop, const QString &desc);
+// void addPropertyDescription(Container *container, const char *prop, const TQString &desc);
// /*! Adds the i18n'ed description of a property value, which will be shown in PropertyEditor. */
-// void addValueDescription(Container *container, const char *value, const QString &desc);
+// void addValueDescription(Container *container, const char *value, const TQString &desc);
/*! \return true if at least one class defined by this factory inherits
a class from other factory. Used in WidgetLibrary::loadFactories()
@@ -449,9 +450,9 @@ class KFORMEDITOR_EXPORT WidgetFactory : public QObject
This slot is called when the line edit text changes, and you have to make
it really change the good property of the widget using changeProperty() (text, or title, etc.).
*/
- virtual bool changeText(const QString &newText);
+ virtual bool changeText(const TQString &newText);
- void changeTextInternal(const QString& text);
+ void changeTextInternal(const TQString& text);
void slotTextChanged();
@@ -460,37 +461,37 @@ class KFORMEDITOR_EXPORT WidgetFactory : public QObject
void widgetDestroyed();
protected:
- QString editorText() const;
- void setEditorText(const QString& text);
- void setEditor(QWidget *widget, QWidget *editor);
- QWidget *editor(QWidget *widget) const;
- void setWidget(QWidget *widget, Container *container);
- QWidget *widget() const;
+ TQString editorText() const;
+ void setEditorText(const TQString& text);
+ void setEditor(TQWidget *widget, TQWidget *editor);
+ TQWidget *editor(TQWidget *widget) const;
+ void setWidget(TQWidget *widget, Container *container);
+ TQWidget *widget() const;
/*! Assigns \a value for internal property \a property for a class \a classname.
Internal properties are not stored within objects, but can be provided
to describe classes' details. */
- void setInternalProperty(const QCString& classname, const QCString& property, const QString& value);
+ void setInternalProperty(const TQCString& classname, const TQCString& property, const TQString& value);
WidgetLibrary *m_library;
- QCString m_editedWidgetClass;
+ TQCString m_editedWidgetClass;
//#ifdef KEXI_KTEXTEDIT
-// QGuardedPtr<KTextEdit> m_editor;
+// TQGuardedPtr<KTextEdit> m_editor;
//#else
-// QGuardedPtr<KLineEdit> m_editor;
+// TQGuardedPtr<KLineEdit> m_editor;
//#endif
- QString m_firstText;
- QGuardedPtr<ResizeHandleSet> m_handles;
- QGuardedPtr<Container> m_container;
+ TQString m_firstText;
+ TQGuardedPtr<ResizeHandleSet> m_handles;
+ TQGuardedPtr<Container> m_container;
// WidgetInfo::List m_classes;
WidgetInfo::Dict m_classesByName;
- QAsciiDict<char>* m_hiddenClasses;
+ TQAsciiDict<char>* m_hiddenClasses;
//! i18n stuff
- QMap<QCString, QString> m_propDesc;
- QMap<QCString, QString> m_propValDesc;
+ TQMap<TQCString, TQString> m_propDesc;
+ TQMap<TQCString, TQString> m_propValDesc;
//! internal properties
- QMap<QCString, QString> m_internalProp;
+ TQMap<TQCString, TQString> m_internalProp;
/*! flag useful to decide whether to hide some properties.
It's value is inherited from WidgetLibrary. */
@@ -500,12 +501,12 @@ class KFORMEDITOR_EXPORT WidgetFactory : public QObject
(and menu items in the future?) for the factory.
Can be empty, e.g. for the main factory which has XMLGUI defined in the shell window itself
(e.g. kexiformpartinstui.rc for Kexi Forms). This name is set in WidgetLibrary::loadFactories() */
- QString m_xmlGUIFileName;
+ TQString m_xmlGUIFileName;
KXMLGUIClient *m_guiClient;
- QGuardedPtr<QWidget> m_widget;
- QGuardedPtr<QWidget> m_editor;
+ TQGuardedPtr<TQWidget> m_widget;
+ TQGuardedPtr<TQWidget> m_editor;
friend class WidgetLibrary;
};