summaryrefslogtreecommitdiffstats
path: root/kexi/formeditor/formIO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/formeditor/formIO.cpp')
-rw-r--r--kexi/formeditor/formIO.cpp152
1 files changed, 76 insertions, 76 deletions
diff --git a/kexi/formeditor/formIO.cpp b/kexi/formeditor/formIO.cpp
index 23c67fb4..2759fe98 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 <textstream.h>
+#include <tqtextstream.h>
#include <tqcursor.h>
#include <tqbuffer.h>
#include <tqimage.h>
-#include <layout.h>
+#include <tqlayout.h>
#include <tqobjectlist.h>
#include <tqdatetime.h>
#include <tqlabel.h>
@@ -66,7 +66,7 @@ void
CustomWidget::paintEvent(TQPaintEvent *)
{
TQPainter p(this);
- p.setPen(palette().active().text());
+ p.setPen(tqpalette().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->metaObject()->findProperty(name, true);
+ int propertyId = w->tqmetaObject()->findProperty(name, true);
if (propertyId == -1 && subpropIface && subpropIface->subwidget()) { // try property from subwidget
subwidget = subpropIface->subwidget();
- propertyId = subpropIface->subwidget()->metaObject()->findProperty(name, true);
+ propertyId = subpropIface->subwidget()->tqmetaObject()->findProperty(name, true);
addSubwidgetFlag = true;
}
if(propertyId == -1)
@@ -420,7 +420,7 @@ FormIO::savePropertyValue(TQDomElement &parentNode, TQDomDocument &parent, const
return;
}
- const TQMetaProperty *meta = subwidget->metaObject()->property(propertyId, true);
+ const TQMetaProperty *meta = subwidget->tqmetaObject()->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().shape()));
+ valueE = parent.createTextNode(TQString::number(value.toCursor().tqshape()));
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->metaObject()->findProperty(name.latin1(), true);
- const TQMetaProperty *meta = count!=-1 ? subobject->metaObject()->property(count, true) : 0;
+ const int count = subobject->tqmetaObject()->findProperty(name.latin1(), true);
+ const TQMetaProperty *meta = count!=-1 ? subobject->tqmetaObject()->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 "alignment"
+ // Important: save dataSource property FIRST before properties like "tqalignment"
// - 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()->metaObject()->findProperty("dataSource"))
+// if (-1 != item->widget()->tqmetaObject()->findProperty("dataSource"))
// savePropertyValue(tclass, domDoc, "dataSource", item->widget()->property("dataSource"), item->widget());
- // We don't want to save the geometry if the widget is inside a layout (so parent.tagName() == "grid" for example)
+ // We don't want to save the tqgeometry if the widget is inside a tqlayout (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 == "alignment") {
+ if(name == "hAlign" || name == "vAlign" || name == "wordbreak" || name == "tqalignment") {
if(!savedAlignment) // not to save it twice
{
- savePropertyValue(tclass, domDoc, "alignment", item->widget()->property("alignment"), item->widget());
+ savePropertyValue(tclass, domDoc, "tqalignment", item->widget()->property("tqalignment"), item->widget());
savedAlignment = true;
}
}
- else if(name == "name" || name == "geometry" || name == "layout") {
+ else if(name == "name" || name == "geometry" || name == "tqlayout") {
// these have already been saved
}
else {
@@ -1017,80 +1017,80 @@ FormIO::saveWidget(ObjectTreeItem *item, TQDomElement &parent, TQDomDocument &do
}
}
- // Saving container 's layout if there is one
- TQDomElement layout;
+ // Saving container 's tqlayout if there is one
+ TQDomElement tqlayout;
if(item->container() && item->container()->layoutType() != Container::NoLayout)
{
- if(item->container()->layout()) // there is a layout
+ if(item->container()->tqlayout()) // there is a tqlayout
{
- layout = domDoc.createElement("temp");
- savePropertyValue(layout, domDoc, "name", "unnamed", item->widget());
+ tqlayout = domDoc.createElement("temp");
+ savePropertyValue(tqlayout, domDoc, "name", "unnamed", item->widget());
if(item->modifiedProperties()->contains("layoutMargin"))
- savePropertyElement(layout, domDoc, "property", "margin", item->container()->layoutMargin());
+ savePropertyElement(tqlayout, domDoc, "property", "margin", item->container()->layoutMargin());
if(item->modifiedProperties()->contains("layoutSpacing"))
- savePropertyElement(layout, domDoc, "property", "spacing", item->container()->layoutSpacing());
- tclass.appendChild(layout);
+ savePropertyElement(tqlayout, domDoc, "property", "spacing", item->container()->layoutSpacing());
+ tclass.appendChild(tqlayout);
}
}
int layoutType = item->container() ? item->container()->layoutType() : Container::NoLayout;
switch(layoutType) {
- case Container::Grid: // grid layout
+ case Container::Grid: // grid tqlayout
{
- layout.setTagName("grid");
- for(ObjectTreeItem *objIt = item->children()->first(); objIt; objIt = item->children()->next())
- saveWidget(objIt, layout, domDoc, true);
+ tqlayout.setTagName("grid");
+ for(ObjectTreeItem *objIt = item->tqchildren()->first(); objIt; objIt = item->tqchildren()->next())
+ saveWidget(objIt, tqlayout, domDoc, true);
break;
}
case Container::HBox: case Container::VBox:
{
- // as we don't save geometry, we need to sort widgets in the right order, not creation order
+ // as we don't save tqgeometry, we need to sort widgets in the right order, not creation order
WidgetList *list;
- if(layout.tagName() == "hbox") {
+ if(tqlayout.tagName() == "hbox") {
list = new HorWidgetList(item->container()->form()->toplevelContainer()->widget());
- layout.setTagName("hbox");
+ tqlayout.setTagName("hbox");
}
else {
list = new VerWidgetList(item->container()->form()->toplevelContainer()->widget());
- layout.setTagName("vbox");
+ tqlayout.setTagName("vbox");
}
- for(ObjectTreeItem *objTree = item->children()->first(); objTree; objTree = item->children()->next())
+ for(ObjectTreeItem *objTree = item->tqchildren()->first(); objTree; objTree = item->tqchildren()->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, layout, domDoc);
+ saveWidget(titem, tqlayout, domDoc);
}
delete list;
break;
}
case Container::HFlow: case Container::VFlow:
{
- layout.setTagName("grid");
- KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->layout());
+ tqlayout.setTagName("grid");
+ KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->tqlayout());
if(!flow) break;
WidgetList *list = (WidgetList*)flow->widgetList();
// save some special properties
- savePropertyElement(layout, domDoc, "property", "customLayout", Container::layoutTypeToString(item->container()->layoutType()) );
- savePropertyElement(layout, domDoc, "property", "justify", TQVariant(static_cast<KexiFlowLayout*>(item->container()->layout())->isJustified(), 3) );
+ savePropertyElement(tqlayout, domDoc, "property", "customLayout", Container::layoutTypeToString(item->container()->layoutType()) );
+ savePropertyElement(tqlayout, domDoc, "property", "justify", TQVariant(static_cast<KexiFlowLayout*>(item->container()->tqlayout())->isJustified(), 3) );
- // fill the widget's grid info, ie just simulate grid layout
+ // fill the widget's grid info, ie just simulate grid tqlayout
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, layout, domDoc, true); // save grid info for compatibility with TQtDesigner
+ saveWidget(titem, tqlayout, domDoc, true); // save grid info for compatibility with TQtDesigner
}
delete list;
break;
}
default:
{
- for(ObjectTreeItem *objIt = item->children()->first(); objIt; objIt = item->children()->next())
+ for(ObjectTreeItem *objIt = item->tqchildren()->first(); objIt; objIt = item->tqchildren()->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 layout
+ // first, see if it is flow tqlayout
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 *layout = (TQGridLayout*)container->layout();
+ TQGridLayout *tqlayout = (TQGridLayout*)container->tqlayout();
if(el.hasAttribute("rowspan")) { // widget spans multiple cells
- if(layout)
- layout->addMultiCellWidget(w, el.attribute("row").toInt(), el.attribute("row").toInt() + el.attribute("rowspan").toInt()-1,
+ if(tqlayout)
+ tqlayout->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(layout)
- layout->addWidget(w, el.attribute("row").toInt(), el.attribute("column").toInt());
+ if(tqlayout)
+ tqlayout->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->layout())
- container->layout()->add(w);
+ else if(container->tqlayout())
+ container->tqlayout()->add(w);
readChildNodes(item, container, el, w);
- if(item->container() && item->container()->layout())
- item->container()->layout()->activate();
+ if(item->container() && item->container()->tqlayout())
+ item->container()->tqlayout()->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->metaObject()->findProperty(*it, true) != -1)
+ if(subwidget->tqmetaObject()->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 layout names
+ (name == "name")) // we don't care about tqlayout 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()->layout()) {
+ item->container() && item->container()->tqlayout()) {
// 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()->layout()->setMargin(margin);
+ item->container()->tqlayout()->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()->layout()->setSpacing(spacing);
+ item->container()->tqlayout()->setSpacing(spacing);
}
else if((name == "justify")){
bool justify = readPropertyValue(node.firstChild(), TQT_TQOBJECT(w), name).toBool();
- KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->layout());
+ KexiFlowLayout *flow = static_cast<KexiFlowLayout*>(item->container()->tqlayout());
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->metaObject()->findProperty(name.latin1(), true) == -1)
+ else if(subwidget->tqmetaObject()->findProperty(name.latin1(), true) == -1)
{
- if(w->className() == TQString::fromLatin1("CustomWidget"))
+ if(w->className() == TQString::tqfromLatin1("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 geometry if needed - this is top level form widget
+ //fix tqgeometry 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->metaObject()->findProperty(name, true);
-// const TQMetaProperty *meta = w->metaObject()->property(count, true);
+// int count = w->tqmetaObject()->findProperty(name, true);
+// const TQMetaProperty *meta = w->tqmetaObject()->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 layout
+ // first, see if it is flow tqlayout
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 *layout = new KexiFlowLayout(item->widget());
- layout->setOrientation(Qt::Horizontal);
- item->container()->m_layout = (TQLayout*)layout;
+ KexiFlowLayout *tqlayout = new KexiFlowLayout(item->widget());
+ tqlayout->setOrientation(Qt::Horizontal);
+ item->container()->m_layout = (TQLayout*)tqlayout;
}
else if(layoutName == "VFlow") {
item->container()->m_layType = Container::VFlow;
- KexiFlowLayout *layout = new KexiFlowLayout(item->widget());
- layout->setOrientation(Qt::Vertical);
- item->container()->m_layout = (TQLayout*)layout;
+ KexiFlowLayout *tqlayout = new KexiFlowLayout(item->widget());
+ tqlayout->setOrientation(Qt::Vertical);
+ item->container()->m_layout = (TQLayout*)tqlayout;
}
- else { // grid layout
+ else { // grid tqlayout
item->container()->m_layType = Container::Grid;
- TQGridLayout *layout = new TQGridLayout(item->widget(), 1, 1);
- item->container()->m_layout = (TQLayout*)layout;
+ TQGridLayout *tqlayout = new TQGridLayout(item->widget(), 1, 1);
+ item->container()->m_layout = (TQLayout*)tqlayout;
}
readChildNodes(item, container, node, w);
}
else if(tag == "vbox") {
item->container()->m_layType = Container::VBox;
- TQVBoxLayout *layout = new TQVBoxLayout(item->widget());
- item->container()->m_layout = (TQLayout*)layout;
+ TQVBoxLayout *tqlayout = new TQVBoxLayout(item->widget());
+ item->container()->m_layout = (TQLayout*)tqlayout;
readChildNodes(item, container, node, w);
}
else if(tag == "hbox") {
item->container()->m_layType = Container::HBox;
- TQHBoxLayout *layout = new TQHBoxLayout(item->widget());
- item->container()->m_layout = (TQLayout*)layout;
+ TQHBoxLayout *tqlayout = new TQHBoxLayout(item->widget());
+ item->container()->m_layout = (TQLayout*)tqlayout;
readChildNodes(item, container, node, w);
}
else {// unknown tag, we let the Factory handle it
- if(w->className() == TQString::fromLatin1("CustomWidget"))
+ if(w->className() == TQString::tqfromLatin1("CustomWidget"))
item->storeUnknownProperty(node);
else {
bool read = container->form()->library()->readSpecialProperty(