diff options
Diffstat (limited to 'kexi/formeditor/formIO.cpp')
-rw-r--r-- | kexi/formeditor/formIO.cpp | 152 |
1 files changed, 76 insertions, 76 deletions
diff --git a/kexi/formeditor/formIO.cpp b/kexi/formeditor/formIO.cpp index 2759fe98..23c67fb4 100644 --- a/kexi/formeditor/formIO.cpp +++ b/kexi/formeditor/formIO.cpp @@ -23,11 +23,11 @@ #include <tqmetaobject.h> #include <tqdom.h> #include <tqfile.h> -#include <tqtextstream.h> +#include <textstream.h> #include <tqcursor.h> #include <tqbuffer.h> #include <tqimage.h> -#include <tqlayout.h> +#include <layout.h> #include <tqobjectlist.h> #include <tqdatetime.h> #include <tqlabel.h> @@ -66,7 +66,7 @@ void CustomWidget::paintEvent(TQPaintEvent *) { TQPainter p(this); - p.setPen(tqpalette().active().text()); + p.setPen(palette().active().text()); TQRect r(rect()); r.setX(r.x()+2); p.drawText(r, TQt::AlignTop, m_className); @@ -406,10 +406,10 @@ FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &parent, const WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(w); TQWidget *subwidget = w; bool addSubwidgetFlag = false; - int propertyId = w->tqmetaObject()->findProperty(name, true); + int propertyId = w->metaObject()->findProperty(name, true); if (propertyId == -1 && subpropIface && subpropIface->subwidget()) { // try property from subwidget subwidget = subpropIface->subwidget(); - propertyId = subpropIface->subwidget()->tqmetaObject()->findProperty(name, true); + propertyId = subpropIface->subwidget()->metaObject()->findProperty(name, true); addSubwidgetFlag = true; } if(propertyId == -1) @@ -420,7 +420,7 @@ FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &parent, const return; } - const TQMetaProperty *meta = subwidget->tqmetaObject()->property(propertyId, true); + const TQMetaProperty *meta = subwidget->metaObject()->property(propertyId, true); if (!meta->stored( subwidget )) //not storable return; TQDomElement propertyE = parent.createElement("property"); @@ -621,7 +621,7 @@ FormIO::writeVariant(TQDomDocument &parent, TQDomElement &parentNode, TQVariant case TQVariant::Cursor: { type = parent.createElement("cursor"); - valueE = parent.createTextNode(TQString::number(value.toCursor().tqshape())); + valueE = parent.createTextNode(TQString::number(value.toCursor().shape())); type.appendChild(valueE); break; } @@ -880,8 +880,8 @@ FormIO::readPropertyValue(TQDomNode node, TQObject *obj, const TQString &name) { WidgetWithSubpropertiesInterface* subpropIface = dynamic_cast<WidgetWithSubpropertiesInterface*>(obj); TQObject *subobject = (subpropIface && subpropIface->subwidget()) ? TQT_TQOBJECT(subpropIface->subwidget()) : obj; - const int count = subobject->tqmetaObject()->findProperty(name.latin1(), true); - const TQMetaProperty *meta = count!=-1 ? subobject->tqmetaObject()->property(count, true) : 0; + const int count = subobject->metaObject()->findProperty(name.latin1(), true); + const TQMetaProperty *meta = count!=-1 ? subobject->metaObject()->property(count, true) : 0; if (meta) { if (meta->isSetType()) { @@ -964,14 +964,14 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &parent, TQDomDocument &do savePropertyValue(tclass, domDoc, "name", item->widget()->property("name"), item->widget()); - // Important: save dataSource property FIRST before properties like "tqalignment" + // Important: save dataSource property FIRST before properties like "alignment" // - needed when subproperties are defined after subwidget creation, and subwidget is created after setting "dataSource" // (this is the case for KexiDBAutoField) //! @todo more properties like "dataSource" may needed here... -// if (-1 != item->widget()->tqmetaObject()->findProperty("dataSource")) +// if (-1 != item->widget()->metaObject()->findProperty("dataSource")) // savePropertyValue(tclass, domDoc, "dataSource", item->widget()->property("dataSource"), item->widget()); - // We don't want to save the tqgeometry if the widget is inside a tqlayout (so parent.tagName() == "grid" for example) + // We don't want to save the geometry if the widget is inside a layout (so parent.tagName() == "grid" for example) if(item && !item->parent()) { // save form widget size, but not its position savePropertyValue(tclass, domDoc, "geometry", @@ -992,14 +992,14 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &parent, TQDomDocument &do for(TQMap<TQString,TQVariant>::ConstIterator it = map->constBegin(); it != endIt; ++it) { const TQCString name( it.key().latin1() ); - if(name == "hAlign" || name == "vAlign" || name == "wordbreak" || name == "tqalignment") { + if(name == "hAlign" || name == "vAlign" || name == "wordbreak" || name == "alignment") { if(!savedAlignment) // not to save it twice { - savePropertyValue(tclass, domDoc, "tqalignment", item->widget()->property("tqalignment"), item->widget()); + savePropertyValue(tclass, domDoc, "alignment", item->widget()->property("alignment"), item->widget()); savedAlignment = true; } } - else if(name == "name" || name == "geometry" || name == "tqlayout") { + else if(name == "name" || name == "geometry" || name == "layout") { // these have already been saved } else { @@ -1017,80 +1017,80 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &parent, TQDomDocument &do } } - // Saving container 's tqlayout if there is one - TQDomElement tqlayout; + // Saving container 's layout if there is one + TQDomElement layout; if(item->container() && item->container()->layoutType() != Container::NoLayout) { - if(item->container()->tqlayout()) // there is a tqlayout + if(item->container()->layout()) // there is a layout { - tqlayout = domDoc.createElement("temp"); - savePropertyValue(tqlayout, domDoc, "name", "unnamed", item->widget()); + layout = domDoc.createElement("temp"); + savePropertyValue(layout, domDoc, "name", "unnamed", item->widget()); if(item->modifiedProperties()->contains("layoutMargin")) - savePropertyElement(tqlayout, domDoc, "property", "margin", item->container()->layoutMargin()); + savePropertyElement(layout, domDoc, "property", "margin", item->container()->layoutMargin()); if(item->modifiedProperties()->contains("layoutSpacing")) - savePropertyElement(tqlayout, domDoc, "property", "spacing", item->container()->layoutSpacing()); - tclass.appendChild(tqlayout); + savePropertyElement(layout, domDoc, "property", "spacing", item->container()->layoutSpacing()); + tclass.appendChild(layout); } } int layoutType = item->container() ? item->container()->layoutType() : Container::NoLayout; switch(layoutType) { - case Container::Grid: // grid tqlayout + case Container::Grid: // grid layout { - tqlayout.setTagName("grid"); - for(ObjectTreeItem *objIt = item->tqchildren()->first(); objIt; objIt = item->tqchildren()->next()) - saveWidget(objIt, tqlayout, domDoc, true); + layout.setTagName("grid"); + for(ObjectTreeItem *objIt = item->children()->first(); objIt; objIt = item->children()->next()) + saveWidget(objIt, layout, domDoc, true); break; } case Container::HBox: case Container::VBox: { - // as we don't save tqgeometry, we need to sort widgets in the right order, not creation order + // as we don't save geometry, we need to sort widgets in the right order, not creation order WidgetList *list; - if(tqlayout.tagName() == "hbox") { + if(layout.tagName() == "hbox") { list = new HorWidgetList(item->container()->form()->toplevelContainer()->widget()); - tqlayout.setTagName("hbox"); + layout.setTagName("hbox"); } else { list = new VerWidgetList(item->container()->form()->toplevelContainer()->widget()); - tqlayout.setTagName("vbox"); + layout.setTagName("vbox"); } - for(ObjectTreeItem *objTree = item->tqchildren()->first(); objTree; objTree = item->tqchildren()->next()) + for(ObjectTreeItem *objTree = item->children()->first(); objTree; objTree = item->children()->next()) list->append(objTree->widget()); list->sort(); for(TQWidget *obj = list->first(); obj; obj = list->next()) { ObjectTreeItem *titem = item->container()->form()->objectTree()->lookup(obj->name()); if(item) - saveWidget(titem, tqlayout, domDoc); + saveWidget(titem, layout, domDoc); } delete list; break; } case Container::HFlow: case Container::VFlow: { - tqlayout.setTagName("grid"); - KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->tqlayout()); + layout.setTagName("grid"); + KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->layout()); if(!flow) break; WidgetList *list = (WidgetList*)flow->widgetList(); // save some special properties - savePropertyElement(tqlayout, domDoc, "property", "customLayout", Container::layoutTypeToString(item->container()->layoutType()) ); - savePropertyElement(tqlayout, domDoc, "property", "justify", TQVariant(static_cast<KexiFlowLayout*>(item->container()->tqlayout())->isJustified(), 3) ); + savePropertyElement(layout, domDoc, "property", "customLayout", Container::layoutTypeToString(item->container()->layoutType()) ); + savePropertyElement(layout, domDoc, "property", "justify", TQVariant(static_cast<KexiFlowLayout*>(item->container()->layout())->isJustified(), 3) ); - // fill the widget's grid info, ie just simulate grid tqlayout + // fill the widget's grid info, ie just simulate grid layout item->container()->createGridLayout(true); for(TQWidget *obj = list->first(); obj; obj = list->next()) { ObjectTreeItem *titem = item->container()->form()->objectTree()->lookup(obj->name()); if(item) - saveWidget(titem, tqlayout, domDoc, true); // save grid info for compatibility with TQtDesigner + saveWidget(titem, layout, domDoc, true); // save grid info for compatibility with TQtDesigner } delete list; break; } default: { - for(ObjectTreeItem *objIt = item->tqchildren()->first(); objIt; objIt = item->tqchildren()->next()) + for(ObjectTreeItem *objIt = item->children()->first(); objIt; objIt = item->children()->next()) saveWidget(objIt, tclass, domDoc); } } @@ -1153,7 +1153,7 @@ FormIO::loadWidget(Container *container, const TQDomElement &el, TQWidget *paren else if(tagName == "vbox") classname = "VBox"; else if(tagName == "grid") { - // first, see if it is flow tqlayout + // first, see if it is flow layout for(TQDomNode child = n.firstChild(); !child.isNull(); child = child.nextSibling()) { if((child.toElement().tagName() == "property") && (child.toElement().attribute("name") == "customLayout")) @@ -1232,27 +1232,27 @@ FormIO::loadWidget(Container *container, const TQDomElement &el, TQWidget *paren m_currentItem = item; // if we are inside a Grid, we need to insert the widget in the good cell if(container->layoutType() == Container::Grid) { - TQGridLayout *tqlayout = (TQGridLayout*)container->tqlayout(); + TQGridLayout *layout = (TQGridLayout*)container->layout(); if(el.hasAttribute("rowspan")) { // widget spans multiple cells - if(tqlayout) - tqlayout->addMultiCellWidget(w, el.attribute("row").toInt(), el.attribute("row").toInt() + el.attribute("rowspan").toInt()-1, + if(layout) + layout->addMultiCellWidget(w, el.attribute("row").toInt(), el.attribute("row").toInt() + el.attribute("rowspan").toInt()-1, el.attribute("column").toInt(), el.attribute("column").toInt() + el.attribute("colspan").toInt()-1); item->setGridPos(el.attribute("row").toInt(), el.attribute("column").toInt(), el.attribute("rowspan").toInt(), el.attribute("colspan").toInt()); } else { - if(tqlayout) - tqlayout->addWidget(w, el.attribute("row").toInt(), el.attribute("column").toInt()); + if(layout) + layout->addWidget(w, el.attribute("row").toInt(), el.attribute("column").toInt()); item->setGridPos(el.attribute("row").toInt(), el.attribute("column").toInt(), 0, 0); } } - else if(container->tqlayout()) - container->tqlayout()->add(w); + else if(container->layout()) + container->layout()->add(w); readChildNodes(item, container, el, w); - if(item->container() && item->container()->tqlayout()) - item->container()->tqlayout()->activate(); + if(item->container() && item->container()->layout()) + item->container()->layout()->activate(); // We add the autoSaveProperties in the modifProp list of the ObjectTreeItem, so that they are saved later TQValueList<TQCString> list(container->form()->library()->autoSaveProperties(w->className())); @@ -1261,7 +1261,7 @@ FormIO::loadWidget(Container *container, const TQDomElement &el, TQWidget *paren = dynamic_cast<KFormDesigner::WidgetWithSubpropertiesInterface*>(w); TQWidget *subwidget = (subpropIface && subpropIface->subwidget()) ? subpropIface->subwidget() : w; for(TQValueList<TQCString>::ConstIterator it = list.constBegin(); it != endIt; ++it) { - if(subwidget->tqmetaObject()->findProperty(*it, true) != -1) + if(subwidget->metaObject()->findProperty(*it, true) != -1) item->addModifiedProperty(*it, subwidget->property(*it)); } @@ -1337,7 +1337,7 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const TQDomEl //if(name == "geometry") // hasGeometryProp = true; if( ((eltag == "grid") || (eltag == "hbox") || (eltag == "vbox")) && - (name == "name")) // we don't care about tqlayout names + (name == "name")) // we don't care about layout names continue; if (node.attribute("subwidget")=="true") { @@ -1355,30 +1355,30 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const TQDomEl if(name == "buddy") m_buddies->insert(readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toString(), (TQLabel*)w); else if(((eltag == "grid") || (eltag == "hbox") || (eltag == "vbox")) && - item->container() && item->container()->tqlayout()) { + item->container() && item->container()->layout()) { // We load the margin of a Layout if(name == "margin") { int margin = readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toInt(); item->container()->setLayoutMargin(margin); - item->container()->tqlayout()->setMargin(margin); + item->container()->layout()->setMargin(margin); } // We load the spacing of a Layout else if(name == "spacing") { int spacing = readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toInt(); item->container()->setLayoutSpacing(spacing); - item->container()->tqlayout()->setSpacing(spacing); + item->container()->layout()->setSpacing(spacing); } else if((name == "justify")){ bool justify = readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toBool(); - KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->tqlayout()); + KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->layout()); if(flow) flow->setJustified(justify); } } // If the object doesn't have this property, we let the Factory handle it (maybe a special property) - else if(subwidget->tqmetaObject()->findProperty(name.latin1(), true) == -1) + else if(subwidget->metaObject()->findProperty(name.latin1(), true) == -1) { - if(w->className() == TQString::tqfromLatin1("CustomWidget")) + if(w->className() == TQString::fromLatin1("CustomWidget")) item->storeUnknownProperty(node); else { bool read = container->form()->library()->readSpecialProperty( @@ -1391,7 +1391,7 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const TQDomEl { TQVariant val( readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name) ); if(name == "geometry" && dynamic_cast<FormWidget*>(w)) { - //fix tqgeometry if needed - this is top level form widget + //fix geometry if needed - this is top level form widget TQRect r( val.toRect() ); if (r.left()<0) //negative X! r.moveLeft(0); @@ -1400,8 +1400,8 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const TQDomEl val = r; } subwidget->setProperty(name.latin1(), val); -// int count = w->tqmetaObject()->findProperty(name, true); -// const TQMetaProperty *meta = w->tqmetaObject()->property(count, true); +// int count = w->metaObject()->findProperty(name, true); +// const TQMetaProperty *meta = w->metaObject()->property(count, true); // if(meta && meta->isEnumType()) { // val = w->property(name.latin1()); //update: we want a numeric value of enum // } @@ -1419,7 +1419,7 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const TQDomEl loadWidget(container, node, w); } else if(tag == "grid") { - // first, see if it is flow tqlayout + // first, see if it is flow layout TQString layoutName; for(TQDomNode child = node.firstChild(); !child.isNull(); child = child.nextSibling()) { if((child.toElement().tagName() == "property") && (child.toElement().attribute("name") == "customLayout")) { @@ -1430,37 +1430,37 @@ FormIO::readChildNodes(ObjectTreeItem *item, Container *container, const TQDomEl if(layoutName == "HFlow") { item->container()->m_layType = Container::HFlow; - KexiFlowLayout *tqlayout = new KexiFlowLayout(item->widget()); - tqlayout->setOrientation(Qt::Horizontal); - item->container()->m_layout = (TQLayout*)tqlayout; + KexiFlowLayout *layout = new KexiFlowLayout(item->widget()); + layout->setOrientation(Qt::Horizontal); + item->container()->m_layout = (TQLayout*)layout; } else if(layoutName == "VFlow") { item->container()->m_layType = Container::VFlow; - KexiFlowLayout *tqlayout = new KexiFlowLayout(item->widget()); - tqlayout->setOrientation(Qt::Vertical); - item->container()->m_layout = (TQLayout*)tqlayout; + KexiFlowLayout *layout = new KexiFlowLayout(item->widget()); + layout->setOrientation(Qt::Vertical); + item->container()->m_layout = (TQLayout*)layout; } - else { // grid tqlayout + else { // grid layout item->container()->m_layType = Container::Grid; - TQGridLayout *tqlayout = new TQGridLayout(item->widget(), 1, 1); - item->container()->m_layout = (TQLayout*)tqlayout; + TQGridLayout *layout = new TQGridLayout(item->widget(), 1, 1); + item->container()->m_layout = (TQLayout*)layout; } readChildNodes(item, container, node, w); } else if(tag == "vbox") { item->container()->m_layType = Container::VBox; - TQVBoxLayout *tqlayout = new TQVBoxLayout(item->widget()); - item->container()->m_layout = (TQLayout*)tqlayout; + TQVBoxLayout *layout = new TQVBoxLayout(item->widget()); + item->container()->m_layout = (TQLayout*)layout; readChildNodes(item, container, node, w); } else if(tag == "hbox") { item->container()->m_layType = Container::HBox; - TQHBoxLayout *tqlayout = new TQHBoxLayout(item->widget()); - item->container()->m_layout = (TQLayout*)tqlayout; + TQHBoxLayout *layout = new TQHBoxLayout(item->widget()); + item->container()->m_layout = (TQLayout*)layout; readChildNodes(item, container, node, w); } else {// unknown tag, we let the Factory handle it - if(w->className() == TQString::tqfromLatin1("CustomWidget")) + if(w->className() == TQString::fromLatin1("CustomWidget")) item->storeUnknownProperty(node); else { bool read = container->form()->library()->readSpecialProperty( |