diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/formeditor/widgetpropertyset.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/formeditor/widgetpropertyset.cpp')
-rw-r--r-- | kexi/formeditor/widgetpropertyset.cpp | 374 |
1 files changed, 187 insertions, 187 deletions
diff --git a/kexi/formeditor/widgetpropertyset.cpp b/kexi/formeditor/widgetpropertyset.cpp index 497fb5e6..e1c3a1e9 100644 --- a/kexi/formeditor/widgetpropertyset.cpp +++ b/kexi/formeditor/widgetpropertyset.cpp @@ -19,14 +19,14 @@ */ #include "widgetpropertyset.h" -#include <qstringlist.h> -#include <qstrlist.h> -#include <qmetaobject.h> -#include <qvariant.h> -#include <qevent.h> -#include <qlayout.h> -#include <qapplication.h> -#include <qeventloop.h> +#include <tqstringlist.h> +#include <tqstrlist.h> +#include <tqmetaobject.h> +#include <tqvariant.h> +#include <tqevent.h> +#include <tqlayout.h> +#include <tqapplication.h> +#include <tqeventloop.h> #include <klocale.h> #include <kdebug.h> @@ -48,7 +48,7 @@ using namespace KFormDesigner; namespace KFormDesigner { //! @internal -typedef QValueList< QGuardedPtr<QWidget> > QGuardedWidgetList; +typedef TQValueList< TQGuardedPtr<TQWidget> > TQGuardedWidgetList; //! @internal class WidgetPropertySetPrivate @@ -67,9 +67,9 @@ class WidgetPropertySetPrivate KoProperty::Set set; // list of properties (not) to show in editor - QStringList properties; + TQStringList properties; // list of widgets - QGuardedWidgetList widgets; + TQGuardedWidgetList widgets; // FormManager *manager; // used to update command's value when undoing @@ -80,24 +80,24 @@ class WidgetPropertySetPrivate bool slotPropertyChanged_addCommandEnabled : 1; // helper to change color palette when switching 'enabled' property - QColorGroup* origActiveColors; + TQColorGroup* origActiveColors; // i18n stuff - QMap<QCString, QString> propCaption; - QMap<QCString, QString> propValCaption; + TQMap<TQCString, TQString> propCaption; + TQMap<TQCString, TQString> propValCaption; }; } -WidgetPropertySet::WidgetPropertySet(QObject *parent) - : QObject(parent, "kfd_widgetPropertySet") +WidgetPropertySet::WidgetPropertySet(TQObject *tqparent) + : TQObject(tqparent, "kfd_widgetPropertySet") { d = new WidgetPropertySetPrivate(); // d->manager = manager; - connect(&d->set, SIGNAL(propertyChanged(KoProperty::Set&, KoProperty::Property&)), - this, SLOT(slotPropertyChanged(KoProperty::Set&, KoProperty::Property&))); - connect(&d->set, SIGNAL(propertyReset(KoProperty::Set&, KoProperty::Property&)), - this, SLOT(slotPropertyReset(KoProperty::Set&, KoProperty::Property&))); + connect(&d->set, TQT_SIGNAL(propertyChanged(KoProperty::Set&, KoProperty::Property&)), + this, TQT_SLOT(slotPropertyChanged(KoProperty::Set&, KoProperty::Property&))); + connect(&d->set, TQT_SIGNAL(propertyReset(KoProperty::Set&, KoProperty::Property&)), + this, TQT_SLOT(slotPropertyReset(KoProperty::Set&, KoProperty::Property&))); initPropertiesDescription(); } @@ -114,21 +114,21 @@ WidgetPropertySet::manager() }*/ KoProperty::Property& -WidgetPropertySet::operator[](const QCString &name) +WidgetPropertySet::operator[](const TQCString &name) { return d->set[name]; } KoProperty::Property& -WidgetPropertySet::property(const QCString &name) +WidgetPropertySet::property(const TQCString &name) { return d->set[name]; } bool -WidgetPropertySet::contains(const QCString &property) +WidgetPropertySet::tqcontains(const TQCString &property) { - return d->set.contains(property); + return d->set.tqcontains(property); } KoProperty::Set* @@ -159,7 +159,7 @@ WidgetPropertySet::clearSet(bool dontSignalShowPropertySet) void WidgetPropertySet::saveModifiedProperties() { - QWidget * w = d->widgets.first(); + TQWidget * w = d->widgets.first(); if(!w || d->widgets.count() > 1 || !KFormDesigner::FormManager::self()->activeForm() || !KFormDesigner::FormManager::self()->activeForm()->objectTree()) return; ObjectTreeItem *tree = KFormDesigner::FormManager::self()->activeForm()->objectTree()->lookup(w->name()); @@ -187,7 +187,7 @@ WidgetPropertySet::isUndoing() /////////////// Functions related to adding widgets ///////////////////////////////////// void -WidgetPropertySet::setSelectedWidget(QWidget *w, bool add, bool forceReload, bool moreWillBeSelected) +WidgetPropertySet::setSelectedWidget(TQWidget *w, bool add, bool forceReload, bool moreWillBeSelected) { if(!w) { clearSet(); @@ -195,7 +195,7 @@ WidgetPropertySet::setSelectedWidget(QWidget *w, bool add, bool forceReload, boo } // don't add a widget twice - if(!forceReload && d->widgets.contains(QGuardedPtr<QWidget>(w))) { + if(!forceReload && d->widgets.tqcontains(TQGuardedPtr<TQWidget>(w))) { kdWarning() << "WidgetPropertySet::setSelectedWidget() Widget is already selected" << endl; return; } @@ -203,7 +203,7 @@ WidgetPropertySet::setSelectedWidget(QWidget *w, bool add, bool forceReload, boo if(d->widgets.count() == 0) add = false; - QCString prevProperty; + TQCString prevProperty; if(add) addWidget(w); else { @@ -212,11 +212,11 @@ WidgetPropertySet::setSelectedWidget(QWidget *w, bool add, bool forceReload, boo prevProperty = d->set.prevSelection(); } clearSet(true); //clear but do not reload to avoid blinking - d->widgets.append(QGuardedPtr<QWidget>(w)); + d->widgets.append(TQGuardedPtr<TQWidget>(w)); createPropertiesForWidget(w); w->installEventFilter(this); - connect(w, SIGNAL(destroyed()), this, SLOT(slotWidgetDestroyed())); + connect(w, TQT_SIGNAL(destroyed()), this, TQT_SLOT(slotWidgetDestroyed())); } if (!moreWillBeSelected) @@ -224,16 +224,16 @@ WidgetPropertySet::setSelectedWidget(QWidget *w, bool add, bool forceReload, boo } void -WidgetPropertySet::addWidget(QWidget *w) +WidgetPropertySet::addWidget(TQWidget *w) { - d->widgets.append(QGuardedPtr<QWidget>(w)); + d->widgets.append(TQGuardedPtr<TQWidget>(w)); // Reset some stuff d->lastCommand = 0; d->lastGeoCommand = 0; d->properties.clear(); - QCString classname; + TQCString classname; if(d->widgets.first()->className() == w->className()) classname = d->widgets.first()->className(); @@ -241,7 +241,7 @@ WidgetPropertySet::addWidget(QWidget *w) bool isTopLevel = KFormDesigner::FormManager::self()->isTopLevel(w); //WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(w); -// QWidget *subwidget = isSubproperty ? subpropIface->subwidget() : w; +// TQWidget *subwidget = isSubproperty ? subpropIface->subwidget() : w; for(KoProperty::Set::Iterator it(d->set); it.current(); ++it) { kdDebug() << it.currentKey() << endl; @@ -253,7 +253,7 @@ WidgetPropertySet::addWidget(QWidget *w) //second widget, update metainfo d->set["this:className"].setValue("special:multiple"); d->set["this:classString"].setValue( - i18n("Multiple Widgets") + QString(" (%1)").arg(d->widgets.count()) ); + i18n("Multiple Widgets") + TQString(" (%1)").tqarg(d->widgets.count()) ); d->set["this:iconName"].setValue("multiple_obj"); //name doesn't make sense for now d->set["name"].setValue(""); @@ -261,7 +261,7 @@ WidgetPropertySet::addWidget(QWidget *w) } void -WidgetPropertySet::createPropertiesForWidget(QWidget *w) +WidgetPropertySet::createPropertiesForWidget(TQWidget *w) { Form *form; if (!KFormDesigner::FormManager::self() @@ -275,8 +275,8 @@ WidgetPropertySet::createPropertiesForWidget(QWidget *w) if(!tree) return; - const QVariantMap* modifiedProperties = tree->modifiedProperties(); - QVariantMapConstIterator modifiedPropertiesIt; + const TQVariantMap* modifiedProperties = tree->modifiedProperties(); + TQVariantMapConstIterator modifiedPropertiesIt; bool isTopLevel = KFormDesigner::FormManager::self()->isTopLevel(w); // int count = 0; KoProperty::Property *newProp = 0; @@ -287,16 +287,16 @@ WidgetPropertySet::createPropertiesForWidget(QWidget *w) return; } - QStrList pList = w->metaObject()->propertyNames(true); - QStrListIterator it(pList); + TQStrList pList = w->tqmetaObject()->propertyNames(true); + TQStrListIterator it(pList); // add subproperties if available WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(w); - QStrList tmpList; //used to allocate copy of names + TQStrList tmpList; //used to allocate copy of names if (subpropIface) { - QValueList<QCString> subproperies( + TQValueList<TQCString> subproperies( subpropIface->subproperies() ); - foreach(QValueListConstIterator<QCString>, it, subproperies ) { + foreach(TQValueListConstIterator<TQCString>, it, subproperies ) { tmpList.append( *it ); pList.append( tmpList.last() ); kdDebug() << "Added subproperty: " << *it << endl; @@ -306,34 +306,34 @@ WidgetPropertySet::createPropertiesForWidget(QWidget *w) // iterate over the property list, and create Property objects for(; it.current() != 0; ++it) { //kdDebug() << ">> " << it.current() << endl; - const QMetaProperty *subMeta = // special case - subproperty + const TQMetaProperty *subMeta = // special case - subproperty subpropIface ? subpropIface->findMetaSubproperty(it.current()) : 0; - const QMetaProperty *meta = subMeta ? subMeta - : w->metaObject()->property( w->metaObject()->findProperty(*it, true), true); + const TQMetaProperty *meta = subMeta ? subMeta + : w->tqmetaObject()->property( w->tqmetaObject()->tqfindProperty(*it, true), true); if (!meta) continue; const char* propertyName = meta->name(); - QWidget *subwidget = subMeta/*subpropIface*/ ? subpropIface->subwidget() : w; + TQWidget *subwidget = subMeta/*subpropIface*/ ? subpropIface->subwidget() : w; WidgetInfo *subwinfo = form->library()->widgetInfoForClassName(subwidget->className()); // kdDebug() << "$$$ " << subwidget->className() << endl; - if(subwinfo && meta->designable(subwidget) && !d->set.contains(propertyName)) { + if(subwinfo && meta->designable(subwidget) && !d->set.tqcontains(propertyName)) { //! \todo add another list for property description - QString desc( d->propCaption[meta->name()] ); + TQString desc( d->propCaption[meta->name()] ); //! \todo change i18n if (desc.isEmpty()) //try to get property description from factory desc = form->library()->propertyDescForName(subwinfo, propertyName); - modifiedPropertiesIt = modifiedProperties->find(propertyName); + modifiedPropertiesIt = modifiedProperties->tqfind(propertyName); const bool oldValueExists = modifiedPropertiesIt!=modifiedProperties->constEnd(); if(meta->isEnumType()) { - if(qstrcmp(propertyName, "alignment") == 0) { + if(qstrcmp(propertyName, "tqalignment") == 0) { createAlignProperty(meta, w, subwidget); continue; } - QStringList keys = QStringList::fromStrList( meta->enumKeys() ); + TQStringList keys = TQStringList::fromStrList( meta->enumKeys() ); newProp = new KoProperty::Property(propertyName, createValueList(subwinfo, keys), /* assign current or older value */ meta->valueToKey( @@ -347,7 +347,7 @@ WidgetPropertySet::createPropertiesForWidget(QWidget *w) else { newProp = new KoProperty::Property(propertyName, /* assign current or older value */ - oldValueExists ? modifiedPropertiesIt.data() : subwidget->property(propertyName), + oldValueExists ? TQVariant(modifiedPropertiesIt.data()) : TQVariant(subwidget->property(propertyName)), desc, desc, subwinfo->customTypeForProperty(propertyName)); //now set current value, so the old one is stored as old if (oldValueExists) { @@ -378,7 +378,7 @@ WidgetPropertySet::createPropertiesForWidget(QWidget *w) } (*this)["name"].setAutoSync(false); // name should be updated only when pressing Enter - (*this)["enabled"].setValue( QVariant(tree->isEnabled(), 3)); + (*this)["enabled"].setValue( TQVariant(tree->isEnabled(), 3)); if (winfo) { form->library()->setPropertyOptions(*this, *winfo, w); @@ -393,9 +393,9 @@ WidgetPropertySet::createPropertiesForWidget(QWidget *w) /*! let's forget it for now, until we have new complete events editor if (m_manager->lib()->advancedPropertiesVisible()) { // add the signals property - QStrList strlist = w->metaObject()->signalNames(true); - QStrListIterator strIt(strlist); - QStringList list; + TQStrList strlist = w->tqmetaObject()->signalNames(true); + TQStrListIterator strIt(strlist); + TQStringList list; for(; strIt.current() != 0; ++strIt) list.append(*strIt); Property *prop = new Property("signals", i18n("Events")"", @@ -403,20 +403,20 @@ WidgetPropertySet::createPropertiesForWidget(QWidget *w) )); }*/ - if(KFormDesigner::FormManager::self()->activeForm() && tree->container()) // we are a container -> layout property + if(KFormDesigner::FormManager::self()->activeForm() && tree->container()) // we are a container -> tqlayout property createLayoutProperty(tree); } void -WidgetPropertySet::updatePropertyValue(ObjectTreeItem *tree, const char *property, const QMetaProperty *meta) +WidgetPropertySet::updatePropertyValue(ObjectTreeItem *tree, const char *property, const TQMetaProperty *meta) { const char *propertyName = meta ? meta->name() : property; - if (!d->set.contains(propertyName)) + if (!d->set.tqcontains(propertyName)) return; KoProperty::Property p( d->set[propertyName] ); //! \todo what about set properties, and lists properties - QMap<QString, QVariant>::ConstIterator it( tree->modifiedProperties()->find(propertyName) ); + TQMap<TQString, TQVariant>::ConstIterator it( tree->modifiedProperties()->tqfind(propertyName) ); if (it != tree->modifiedProperties()->constEnd()) { blockSignals(true); if(meta && meta->isEnumType()) { @@ -431,7 +431,7 @@ WidgetPropertySet::updatePropertyValue(ObjectTreeItem *tree, const char *propert } bool -WidgetPropertySet::isPropertyVisible(const QCString &property, bool isTopLevel, const QCString &classname) +WidgetPropertySet::isPropertyVisible(const TQCString &property, bool isTopLevel, const TQCString &classname) { const bool multiple = d->widgets.count() >= 2; if(multiple && classname.isEmpty()) @@ -461,9 +461,9 @@ WidgetPropertySet::isPropertyVisible(const QCString &property, bool isTopLevel, */ // return KFormDesigner::FormManager::self()->lib()->isPropertyVisible(d->widgets.first()->className(), d->widgets.first(), - QWidget *w = d->widgets.first(); + TQWidget *w = d->widgets.first(); WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(w); - QWidget *subwidget; + TQWidget *subwidget; if (subpropIface && subpropIface->findMetaSubproperty(property)) // special case - subproperty subwidget = subpropIface->subwidget(); else @@ -484,11 +484,11 @@ WidgetPropertySet::slotPropertyChanged(KoProperty::Set& set, KoProperty::Propert || ! KFormDesigner::FormManager::self()->activeForm()->objectTree()) return; - QCString property = p.name(); - if (0==property.find("this:")) + TQCString property = p.name(); + if (0==property.tqfind("this:")) return; //starts with magical prefix: it's a "meta" prop. - QVariant value = p.value(); + TQVariant value = p.value(); // check if the name is valid (ie is correct identifier) and there is no name conflict if(property == "name") { @@ -507,7 +507,7 @@ WidgetPropertySet::slotPropertyChanged(KoProperty::Set& set, KoProperty::Propert saveAlignProperty(property); return; } - else if((property == "layout") || (property == "layoutMargin") || (property == "layoutSpacing")) { + else if((property == "tqlayout") || (property == "tqlayoutMargin") || (property == "tqlayoutSpacing")) { saveLayoutProperty(property, value); return; } @@ -554,9 +554,9 @@ WidgetPropertySet::slotPropertyChanged(KoProperty::Set& set, KoProperty::Propert else { if (d->slotPropertyChanged_addCommandEnabled && !KFormDesigner::FormManager::self()->isRedoing()) { // We store old values for each widget - QMap<QCString, QVariant> list; - // for(QWidget *w = d->widgets.first(); w; w = d->widgets.next()) - foreach(QGuardedWidgetList::ConstIterator, it, d->widgets) + TQMap<TQCString, TQVariant> list; + // for(TQWidget *w = d->widgets.first(); w; w = d->widgets.next()) + foreach(TQGuardedWidgetList::ConstIterator, it, d->widgets) list.insert((*it)->name(), (*it)->property(property)); d->lastCommand = new PropertyCommand(this, list, value, property); @@ -564,8 +564,8 @@ WidgetPropertySet::slotPropertyChanged(KoProperty::Set& set, KoProperty::Propert } } -// for(QWidget *w = d->widgets.first(); w; w = d->widgets.next()) - foreach(QGuardedWidgetList::ConstIterator, it, d->widgets) { +// for(TQWidget *w = d->widgets.first(); w; w = d->widgets.next()) + foreach(TQGuardedWidgetList::ConstIterator, it, d->widgets) { if (!alterLastCommand) { ObjectTreeItem *tree = KFormDesigner::FormManager::self()->activeForm()->objectTree() ->lookup((*it)->name()); @@ -578,23 +578,23 @@ WidgetPropertySet::slotPropertyChanged(KoProperty::Set& set, KoProperty::Propert } } -void WidgetPropertySet::emitWidgetPropertyChanged(QWidget *w, const QCString& property, const QVariant& value) +void WidgetPropertySet::emitWidgetPropertyChanged(TQWidget *w, const TQCString& property, const TQVariant& value) { emit widgetPropertyChanged(w, property, value); Form *form = KFormDesigner::FormManager::self()->activeForm(); if (form && form->library()->propertySetShouldBeReloadedAfterPropertyChange( w->className(), w, property)) { //setSelectedWidget(0, false); - qApp->eventLoop()->processEvents(QEventLoop::AllEvents); //be sure events related to editors are consumed + tqApp->eventLoop()->processEvents(TQEventLoop::AllEvents); //be sure events related to editors are consumed setSelectedWidget(w, /*!add*/false, /*forceReload*/true); - qApp->eventLoop()->processEvents(QEventLoop::AllEvents); //be sure events related to editors are consumed + tqApp->eventLoop()->processEvents(TQEventLoop::AllEvents); //be sure events related to editors are consumed //KFormDesigner::FormManager::self()->showPropertySet(this, true/*forceReload*/); } } void -WidgetPropertySet::createPropertyCommandsInDesignMode(QWidget* widget, - const QMap<QCString, QVariant> &propValues, CommandGroup *group, bool addToActiveForm, +WidgetPropertySet::createPropertyCommandsInDesignMode(TQWidget* widget, + const TQMap<TQCString, TQVariant> &propValues, CommandGroup *group, bool addToActiveForm, bool execFlagForSubCommands) { if (!widget || propValues.isEmpty()) @@ -604,11 +604,11 @@ WidgetPropertySet::createPropertyCommandsInDesignMode(QWidget* widget, const bool widgetIsSelected = KFormDesigner::FormManager::self()->activeForm()->selectedWidget() == widget; d->slotPropertyChanged_addCommandEnabled = false; - QMap<QCString, QVariant>::ConstIterator endIt = propValues.constEnd(); + TQMap<TQCString, TQVariant>::ConstIterator endIt = propValues.constEnd(); // CommandGroup *group = new CommandGroup(commandName); - for(QMap<QCString, QVariant>::ConstIterator it = propValues.constBegin(); it != endIt; ++it) + for(TQMap<TQCString, TQVariant>::ConstIterator it = propValues.constBegin(); it != endIt; ++it) { - if (!d->set.contains(it.key())) { + if (!d->set.tqcontains(it.key())) { kdWarning() << "WidgetPropertySet::createPropertyCommandsInDesignMode(): \"" <<it.key()<<"\" property not found"<<endl; continue; } @@ -620,8 +620,8 @@ WidgetPropertySet::createPropertyCommandsInDesignMode(QWidget* widget, } else { WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(widget); - QWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : widget; - if (-1 != subwidget->metaObject()->findProperty(it.key(), true) && subwidget->property(it.key())!=it.data()) { + TQWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : widget; + if (-1 != subwidget->tqmetaObject()->tqfindProperty(it.key(), true) && subwidget->property(it.key())!=it.data()) { ObjectTreeItem *tree = KFormDesigner::FormManager::self()->activeForm()->objectTree()->lookup(widget->name()); if (tree) tree->addModifiedProperty(it.key(), subwidget->property(it.key())); @@ -641,44 +641,44 @@ WidgetPropertySet::createPropertyCommandsInDesignMode(QWidget* widget, void WidgetPropertySet::saveEnabledProperty(bool value) { -// for(QWidget *w = d->widgets.first(); w; w = d->widgets.next()) { - foreach(QGuardedWidgetList::ConstIterator, it, d->widgets) { +// for(TQWidget *w = d->widgets.first(); w; w = d->widgets.next()) { + foreach(TQGuardedWidgetList::ConstIterator, it, d->widgets) { ObjectTreeItem *tree = KFormDesigner::FormManager::self()->activeForm()->objectTree() ->lookup((*it)->name()); if(tree->isEnabled() == value) continue; - QPalette p( (*it)->palette() ); + TQPalette p( (*it)->palette() ); if (!d->origActiveColors) - d->origActiveColors = new QColorGroup( p.active() ); + d->origActiveColors = new TQColorGroup( p.active() ); if (value) { if (d->origActiveColors) p.setActive( *d->origActiveColors ); //revert } else { - QColorGroup cg = p.disabled(); + TQColorGroup cg = p.disabled(); //also make base color a bit disabled-like - cg.setColor(QColorGroup::Base, cg.color(QColorGroup::Background)); + cg.setColor(TQColorGroup::Base, cg.color(TQColorGroup::Background)); p.setActive(cg); } (*it)->setPalette(p); tree->setEnabled(value); - emit widgetPropertyChanged((*it), "enabled", QVariant(value, 3)); + emit widgetPropertyChanged((*it), "enabled", TQVariant(value, 3)); } } bool -WidgetPropertySet::isNameValid(const QString &name) +WidgetPropertySet::isNameValid(const TQString &name) { //! \todo add to undo buffer - QWidget *w = d->widgets.first(); - //also update widget's name in QObject member + TQWidget *w = d->widgets.first(); + //also update widget's name in TQObject member if (!KexiUtils::isIdentifier(name)) { KMessageBox::sorry(KFormDesigner::FormManager::self()->activeForm()->widget(), i18n("Could not rename widget \"%1\" to \"%2\" because " "\"%3\" is not a valid name (identifier) for a widget.\n") - .arg(w->name()).arg(name).arg(name)); + .tqarg(w->name()).tqarg(name).tqarg(name)); d->slotPropertyChangedEnabled = false; d->set["name"].resetValue(); d->slotPropertyChangedEnabled = true; @@ -689,7 +689,7 @@ WidgetPropertySet::isNameValid(const QString &name) KMessageBox::sorry( KFormDesigner::FormManager::self()->activeForm()->widget(), i18n("Could not rename widget \"%1\" to \"%2\" " "because a widget with the name \"%3\" already exists.\n") - .arg(w->name()).arg(name).arg(name)); + .tqarg(w->name()).tqarg(name).tqarg(name)); d->slotPropertyChangedEnabled = false; d->set["name"].resetValue(); d->slotPropertyChangedEnabled = true; @@ -708,21 +708,21 @@ WidgetPropertySet::slotPropertyReset(KoProperty::Set& set, KoProperty::Property& return; // We use the old value in modifProp for each widget -// for(QWidget *w = d->widgets.first(); w; w = d->widgets.next()) { - foreach(QGuardedWidgetList::ConstIterator, it, d->widgets) { +// for(TQWidget *w = d->widgets.first(); w; w = d->widgets.next()) { + foreach(TQGuardedWidgetList::ConstIterator, it, d->widgets) { ObjectTreeItem *tree = KFormDesigner::FormManager::self()->activeForm()->objectTree()->lookup((*it)->name()); - if(tree->modifiedProperties()->contains(property.name())) - (*it)->setProperty(property.name(), tree->modifiedProperties()->find(property.name()).data()); + if(tree->modifiedProperties()->tqcontains(property.name())) + (*it)->setProperty(property.name(), tree->modifiedProperties()->tqfind(property.name()).data()); } } void WidgetPropertySet::slotWidgetDestroyed() { -// if(d->widgets.contains(QGuardedPtr<const QWidget>( dynamic_cast<const QWidget*>(sender()) ))) { +// if(d->widgets.tqcontains(TQGuardedPtr<const TQWidget>( dynamic_cast<const TQWidget*>(sender()) ))) { //only clear this set if it contains the destroyed widget - foreach(QGuardedWidgetList::ConstIterator, it, d->widgets) { - if (dynamic_cast<const QWidget*>(sender()) == *it) { + foreach(TQGuardedWidgetList::ConstIterator, it, d->widgets) { + if (dynamic_cast<const TQWidget*>(sender()) == *it) { clearSet(); break; } @@ -730,32 +730,32 @@ WidgetPropertySet::slotWidgetDestroyed() } bool -WidgetPropertySet::eventFilter(QObject *o, QEvent *ev) +WidgetPropertySet::eventFilter(TQObject *o, TQEvent *ev) { if(d->widgets.count() > 0 && o == d->widgets.first() && d->widgets.count() < 2) { - if((ev->type() == QEvent::Resize) || (ev->type() == QEvent::Move)) { - if(!d->set.contains("geometry")) + if((ev->type() == TQEvent::Resize) || (ev->type() == TQEvent::Move)) { + if(!d->set.tqcontains("geometry")) return false; if(d->set["geometry"].value() == o->property("geometry")) // to avoid infinite recursion return false; - d->set["geometry"] = static_cast<QWidget*>(o)->geometry(); + d->set["geometry"] = TQT_TQWIDGET(o)->tqgeometry(); } } - else if(d->widgets.count() > 1 && ev->type() == QEvent::Move) // the widget is being moved, we update the property + else if(d->widgets.count() > 1 && ev->type() == TQEvent::Move) // the widget is being moved, we update the property { if(d->isUndoing) return false; if(d->lastGeoCommand) - d->lastGeoCommand->setPos(static_cast<QMoveEvent*>(ev)->pos()); + d->lastGeoCommand->setPos(TQT_TQMOVEEVENT(ev)->pos()); else { - QStringList list; - foreach(QGuardedWidgetList::ConstIterator, it, d->widgets) + TQStringList list; + foreach(TQGuardedWidgetList::ConstIterator, it, d->widgets) list.append((*it)->name()); - d->lastGeoCommand = new GeometryPropertyCommand(this, list, static_cast<QMoveEvent*>(ev)->oldPos()); + d->lastGeoCommand = new GeometryPropertyCommand(this, list, TQT_TQMOVEEVENT(ev)->oldPos()); if (KFormDesigner::FormManager::self()->activeForm()) KFormDesigner::FormManager::self()->activeForm()->addCommand(d->lastGeoCommand, false); } @@ -767,33 +767,33 @@ WidgetPropertySet::eventFilter(QObject *o, QEvent *ev) // Alignment-related functions ///////////////////////////// void -WidgetPropertySet::createAlignProperty(const QMetaProperty *meta, QWidget *widget, QWidget *subwidget) +WidgetPropertySet::createAlignProperty(const TQMetaProperty *meta, TQWidget *widget, TQWidget *subwidget) { if (!KFormDesigner::FormManager::self()->activeForm() || !KFormDesigner::FormManager::self()->activeForm()->objectTree()) return; - QStringList list; - QString value; - const int alignment = subwidget->property("alignment").toInt(); - const QStringList keys( QStringList::fromStrList( meta->valueToKeys(alignment) ) ); + TQStringList list; + TQString value; + const int tqalignment = subwidget->property("tqalignment").toInt(); + const TQStringList keys( TQStringList::fromStrList( meta->valueToKeys(tqalignment) ) ); - QStrList *enumKeys = new QStrList(meta->enumKeys()); - const QStringList possibleValues( QStringList::fromStrList(*enumKeys) ); + TQStrList *enumKeys = new TQStrList(meta->enumKeys()); + const TQStringList possibleValues( TQStringList::fromStrList(*enumKeys) ); delete enumKeys; ObjectTreeItem *tree = KFormDesigner::FormManager::self()->activeForm()->objectTree()->lookup(widget->name()); bool isTopLevel = KFormDesigner::FormManager::self()->isTopLevel(widget); - if(possibleValues.find("AlignHCenter")!=possibleValues.constEnd()) { - // Create the horizontal alignment property - if(keys.find("AlignHCenter")!=keys.constEnd() || keys.find("AlignCenter")!=keys.constEnd()) + if(possibleValues.tqfind("AlignHCenter")!=possibleValues.constEnd()) { + // Create the horizontal tqalignment property + if(keys.tqfind("AlignHCenter")!=keys.constEnd() || keys.tqfind("AlignCenter")!=keys.constEnd()) value = "AlignHCenter"; - else if(keys.find("AlignRight")!=keys.constEnd()) + else if(keys.tqfind("AlignRight")!=keys.constEnd()) value = "AlignRight"; - else if(keys.find("AlignLeft")!=keys.constEnd()) + else if(keys.tqfind("AlignLeft")!=keys.constEnd()) value = "AlignLeft"; - else if(keys.find("AlignJustify")!=keys.constEnd()) + else if(keys.tqfind("AlignJustify")!=keys.constEnd()) value = "AlignJustify"; else value = "AlignAuto"; @@ -810,12 +810,12 @@ WidgetPropertySet::createAlignProperty(const QMetaProperty *meta, QWidget *widge list.clear(); } - if(possibleValues.find("AlignTop")!=possibleValues.constEnd()) + if(possibleValues.tqfind("AlignTop")!=possibleValues.constEnd()) { - // Create the ver alignment property - if(keys.find("AlignTop")!=keys.constEnd()) + // Create the ver tqalignment property + if(keys.tqfind("AlignTop")!=keys.constEnd()) value = "AlignTop"; - else if(keys.find("AlignBottom")!=keys.constEnd()) + else if(keys.tqfind("AlignBottom")!=keys.constEnd()) value = "AlignBottom"; else value = "AlignVCenter"; @@ -831,13 +831,13 @@ WidgetPropertySet::createAlignProperty(const QMetaProperty *meta, QWidget *widge updatePropertyValue(tree, "vAlign"); } - if(possibleValues.find("WordBreak")!=possibleValues.constEnd() + if(possibleValues.tqfind("WordBreak")!=possibleValues.constEnd() // && isPropertyVisible("wordbreak", false, subwidget->className()) -// && !subWidget->inherits("QLineEdit") /* QLineEdit doesn't support 'word break' is this generic enough?*/ +// && !subWidget->inherits(TQLINEEDIT_OBJECT_NAME_STRING) /* TQLineEdit doesn't support 'word break' is this generic enough?*/ ) { // Create the wordbreak property KoProperty::Property *p = new KoProperty::Property("wordbreak", - QVariant(alignment & Qt::WordBreak, 3), i18n("Word Break"), i18n("Word Break") ); + TQVariant(tqalignment & TQt::WordBreak, 3), i18n("Word Break"), i18n("Word Break") ); d->set.addProperty(p); updatePropertyValue(tree, "wordbreak"); if (!KFormDesigner::FormManager::self()->activeForm()->library()->isPropertyVisible( @@ -849,25 +849,25 @@ WidgetPropertySet::createAlignProperty(const QMetaProperty *meta, QWidget *widge } void -WidgetPropertySet::saveAlignProperty(const QString &property) +WidgetPropertySet::saveAlignProperty(const TQString &property) { if (!KFormDesigner::FormManager::self()->activeForm()) return; - QStrList list; - if( d->set.contains("hAlign") ) + TQStrList list; + if( d->set.tqcontains("hAlign") ) list.append( d->set["hAlign"].value().toCString() ); - if( d->set.contains("vAlign") ) + if( d->set.tqcontains("vAlign") ) list.append( d->set["vAlign"].value().toCString() ); - if( d->set.contains("wordbreak") && d->set["wordbreak"].value().toBool() ) + if( d->set.tqcontains("wordbreak") && d->set["wordbreak"].value().toBool() ) list.append("WordBreak"); WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>( - (QWidget*)d->widgets.first() ); - QWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : (QWidget*)d->widgets.first(); - int count = subwidget->metaObject()->findProperty("alignment", true); - const QMetaProperty *meta = subwidget->metaObject()->property(count, true); - subwidget->setProperty("alignment", meta->keysToValue(list)); + (TQWidget*)d->widgets.first() ); + TQWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : (TQWidget*)d->widgets.first(); + int count = subwidget->tqmetaObject()->tqfindProperty("tqalignment", true); + const TQMetaProperty *meta = subwidget->tqmetaObject()->property(count, true); + subwidget->setProperty("tqalignment", meta->keysToValue(list)); ObjectTreeItem *tree = KFormDesigner::FormManager::self()->activeForm()->objectTree()->lookup( d->widgets.first()->name() ); @@ -877,11 +877,11 @@ WidgetPropertySet::saveAlignProperty(const QString &property) if(d->isUndoing) return; - if(d->lastCommand && d->lastCommand->property() == "alignment") + if(d->lastCommand && d->lastCommand->property() == "tqalignment") d->lastCommand->setValue(meta->keysToValue(list)); else { d->lastCommand = new PropertyCommand(this, d->widgets.first()->name(), - subwidget->property("alignment"), meta->keysToValue(list), "alignment"); + subwidget->property("tqalignment"), meta->keysToValue(list), "tqalignment"); KFormDesigner::FormManager::self()->activeForm()->addCommand(d->lastCommand, false); } } @@ -895,40 +895,40 @@ WidgetPropertySet::createLayoutProperty(ObjectTreeItem *item) if (!container || !KFormDesigner::FormManager::self()->activeForm() || !KFormDesigner::FormManager::self()->activeForm()->objectTree() || !container->widget()) return; - // special containers have no 'layout' property, as it should not be changed - QCString className = container->widget()->className(); + // special containers have no 'tqlayout' property, as it should not be changed + TQCString className = container->widget()->className(); if((className == "HBox") || (className == "VBox") || (className == "Grid")) return; - QStringList list; - QString value = Container::layoutTypeToString(container->layoutType()); + TQStringList list; + TQString value = Container::tqlayoutTypeToString(container->tqlayoutType()); list << "NoLayout" << "HBox" << "VBox" << "Grid" << "HFlow" << "VFlow"; - KoProperty::Property *p = new KoProperty::Property("layout", createValueList(0, list), value, + KoProperty::Property *p = new KoProperty::Property("tqlayout", createValueList(0, list), value, i18n("Container's Layout"), i18n("Container's Layout")); p->setVisible( container->form()->library()->advancedPropertiesVisible() ); d->set.addProperty(p); - updatePropertyValue(item, "layout"); + updatePropertyValue(item, "tqlayout"); - p = new KoProperty::Property("layoutMargin", container->layoutMargin(), i18n("Layout Margin"), i18n("Layout Margin")); + p = new KoProperty::Property("tqlayoutMargin", container->tqlayoutMargin(), i18n("Layout Margin"), i18n("Layout Margin")); d->set.addProperty(p); - updatePropertyValue(item, "layoutMargin"); - if(container->layoutType() == Container::NoLayout) + updatePropertyValue(item, "tqlayoutMargin"); + if(container->tqlayoutType() == Container::NoLayout) p->setVisible(false); - p = new KoProperty::Property("layoutSpacing", container->layoutSpacing(), + p = new KoProperty::Property("tqlayoutSpacing", container->tqlayoutSpacing(), i18n("Layout Spacing"), i18n("Layout Spacing")); d->set.addProperty(p); - updatePropertyValue(item, "layoutSpacing"); - if(container->layoutType() == Container::NoLayout) + updatePropertyValue(item, "tqlayoutSpacing"); + if(container->tqlayoutType() == Container::NoLayout) p->setVisible(false); } void -WidgetPropertySet::saveLayoutProperty(const QString &prop, const QVariant &value) +WidgetPropertySet::saveLayoutProperty(const TQString &prop, const TQVariant &value) { Container *container=0; if(!KFormDesigner::FormManager::self()->activeForm() || !KFormDesigner::FormManager::self()->activeForm()->objectTree()) @@ -938,34 +938,34 @@ WidgetPropertySet::saveLayoutProperty(const QString &prop, const QVariant &value return; container = item->container(); - if(prop == "layout") { + if(prop == "tqlayout") { Container::LayoutType type = Container::stringToLayoutType(value.toString()); - if(d->lastCommand && d->lastCommand->property() == "layout" && !d->isUndoing) + if(d->lastCommand && d->lastCommand->property() == "tqlayout" && !d->isUndoing) d->lastCommand->setValue(value); else if(!d->isUndoing) { d->lastCommand = new LayoutPropertyCommand(this, d->widgets.first()->name(), - d->set["layout"].oldValue(), value); + d->set["tqlayout"].oldValue(), value); KFormDesigner::FormManager::self()->activeForm()->addCommand(d->lastCommand, false); } container->setLayout(type); bool show = (type != Container::NoLayout); - if(show != d->set["layoutMargin"].isVisible()) { - d->set["layoutMargin"].setVisible(show); - d->set["layoutSpacing"].setVisible(show); + if(show != d->set["tqlayoutMargin"].isVisible()) { + d->set["tqlayoutMargin"].setVisible(show); + d->set["tqlayoutSpacing"].setVisible(show); KFormDesigner::FormManager::self()->showPropertySet(this, true/*force*/); } return; } - if(prop == "layoutMargin" && container->layout()) { + if(prop == "tqlayoutMargin" && container->tqlayout()) { container->setLayoutMargin(value.toInt()); - container->layout()->setMargin(value.toInt()); + container->tqlayout()->setMargin(value.toInt()); } - else if(prop == "layoutSpacing" && container->layout()) { + else if(prop == "tqlayoutSpacing" && container->tqlayout()) { container->setLayoutSpacing(value.toInt()); - container->layout()->setSpacing(value.toInt()); + container->tqlayout()->setSpacing(value.toInt()); } ObjectTreeItem *tree = KFormDesigner::FormManager::self()->activeForm()->objectTree()->lookup(d->widgets.first()->name()); @@ -975,7 +975,7 @@ WidgetPropertySet::saveLayoutProperty(const QString &prop, const QVariant &value if(d->isUndoing) return; - if(d->lastCommand && (QString(d->lastCommand->property()) == prop)) + if(d->lastCommand && (TQString(d->lastCommand->property()) == prop)) d->lastCommand->setValue(value); else { d->lastCommand = new PropertyCommand(this, d->widgets.first()->name(), @@ -992,7 +992,7 @@ void WidgetPropertySet::initPropertiesDescription() { //! \todo perhaps a few of them shouldn't be translated within KFD mode, -//! to be more Qt Designer friendly? +//! to be more TQt Designer friendly? d->propCaption["name"] = i18n("Name"); d->propCaption["caption"] = i18n("Caption"); d->propCaption["text"] = i18n("Text"); @@ -1000,8 +1000,8 @@ WidgetPropertySet::initPropertiesDescription() d->propCaption["enabled"] = i18n("Enabled"); d->propCaption["geometry"] = i18n("Geometry"); d->propCaption["sizePolicy"] = i18n("Size Policy"); - d->propCaption["minimumSize"] = i18n("Minimum Size"); - d->propCaption["maximumSize"] = i18n("Maximum Size"); + d->propCaption["tqminimumSize"] = i18n("Minimum Size"); + d->propCaption["tqmaximumSize"] = i18n("Maximum Size"); d->propCaption["font"] = i18n("Font"); d->propCaption["cursor"] = i18n("Cursor"); d->propCaption["paletteForegroundColor"] = i18n("Foreground Color"); @@ -1009,13 +1009,13 @@ WidgetPropertySet::initPropertiesDescription() d->propCaption["focusPolicy"] = i18n("Focus Policy"); d->propCaption["margin"] = i18n("Margin"); d->propCaption["readOnly"] = i18n("Read Only"); - //any QFrame + //any TQFrame d->propCaption["frame"] = i18n("Frame"); d->propCaption["lineWidth"] = i18n("Frame Width"); d->propCaption["midLineWidth"] = i18n("Mid Frame Width"); d->propCaption["frameShape"] = i18n("Frame Shape"); d->propCaption["frameShadow"] = i18n("Frame Shadow"); - //any QScrollbar + //any TQScrollbar d->propCaption["vScrollBarMode"] = i18n("Vertical ScrollBar"); d->propCaption["hScrollBarMode"] = i18n("Horizontal ScrollBar"); @@ -1066,27 +1066,27 @@ WidgetPropertySet::initPropertiesDescription() d->propValCaption["Vertical"] = i18n("Vertical"); } -QString -WidgetPropertySet::propertyCaption(const QCString &name) +TQString +WidgetPropertySet::propertyCaption(const TQCString &name) { return d->propCaption[name]; } -QString -WidgetPropertySet::valueCaption(const QCString &name) +TQString +WidgetPropertySet::valueCaption(const TQCString &name) { return d->propValCaption[name]; } KoProperty::Property::ListData* -WidgetPropertySet::createValueList(WidgetInfo *winfo, const QStringList &list) +WidgetPropertySet::createValueList(WidgetInfo *winfo, const TQStringList &list) { -// QMap <QString, QVariant> map; - QStringList names; - QStringList::ConstIterator endIt = list.end(); - for(QStringList::ConstIterator it = list.begin(); it != endIt; ++it) { - QString n( d->propValCaption[ (*it).latin1() ] ); - if (n.isEmpty()) { //try within factory and (maybe) parent factory +// TQMap <TQString, TQVariant> map; + TQStringList names; + TQStringList::ConstIterator endIt = list.end(); + for(TQStringList::ConstIterator it = list.begin(); it != endIt; ++it) { + TQString n( d->propValCaption[ (*it).latin1() ] ); + if (n.isEmpty()) { //try within factory and (maybe) tqparent factory if (winfo) n = KFormDesigner::FormManager::self()->activeForm()->library()->propertyDescForValue( winfo, (*it).latin1() ); if (n.isEmpty()) @@ -1104,16 +1104,16 @@ WidgetPropertySet::createValueList(WidgetInfo *winfo, const QStringList &list) } void -WidgetPropertySet::addPropertyCaption(const QCString &property, const QString &caption) +WidgetPropertySet::addPropertyCaption(const TQCString &property, const TQString &caption) { - if(!d->propCaption.contains(property)) + if(!d->propCaption.tqcontains(property)) d->propCaption[property] = caption; } void -WidgetPropertySet::addValueCaption(const QCString &value, const QString &caption) +WidgetPropertySet::addValueCaption(const TQCString &value, const TQString &caption) { - if(!d->propValCaption.contains(value)) + if(!d->propValCaption.tqcontains(value)) d->propValCaption[value] = caption; } |