diff options
Diffstat (limited to 'kexi/formeditor/utils.cpp')
-rw-r--r-- | kexi/formeditor/utils.cpp | 103 |
1 files changed, 52 insertions, 51 deletions
diff --git a/kexi/formeditor/utils.cpp b/kexi/formeditor/utils.cpp index 0c3acf59..f80c2c27 100644 --- a/kexi/formeditor/utils.cpp +++ b/kexi/formeditor/utils.cpp @@ -18,10 +18,10 @@ * Boston, MA 02110-1301, USA. */ -#include <qcursor.h> -#include <qobjectlist.h> -#include <qtabwidget.h> -#include <qtabbar.h> +#include <tqcursor.h> +#include <tqobjectlist.h> +#include <tqtabwidget.h> +#include <tqtabbar.h> #include <kdebug.h> #include <kexiutils/utils.h> @@ -36,11 +36,11 @@ void KFormDesigner::removeChildrenFromList(WidgetList &list) { for(WidgetListIterator it(list); it.current() != 0; ++it) { - QWidget *w = it.current(); + TQWidget *w = it.current(); // If any widget in the list is a child of this widget, we remove it from the list for(WidgetListIterator it2(list); it2.current() != 0; ++it2) { - QWidget *widg = it2.current(); + TQWidget *widg = it2.current(); if((w != widg) && (w->child(widg->name()))) { kdDebug() << "Removing the widget " << widg->name() << "which is a child of " << w->name() << endl; @@ -51,76 +51,77 @@ KFormDesigner::removeChildrenFromList(WidgetList &list) } void -KFormDesigner::installRecursiveEventFilter(QObject *object, QObject *container) +KFormDesigner::installRecursiveEventFilter(TQObject *object, TQObject *container) { if(!object || !container|| !object->isWidgetType()) return; kdDebug() << "Installing event filter on widget: " << object->name() << " directed to " << container->name() << endl; object->installEventFilter(container); - if(((QWidget*)object)->ownCursor()) - ((QWidget*)object)->setCursor(QCursor(Qt::ArrowCursor)); + if(((TQWidget*)object)->ownCursor()) + ((TQWidget*)object)->setCursor(TQCursor(TQt::ArrowCursor)); - if(!object->children()) + TQObjectList list = object->childrenListObject(); + + if(list.isEmpty()) return; - QObjectList list = *(object->children()); - for(QObject *obj = list.first(); obj; obj = list.next()) + for(TQObject *obj = list.first(); obj; obj = list.next()) installRecursiveEventFilter(obj, container); } void -KFormDesigner::removeRecursiveEventFilter(QObject *object, QObject *container) +KFormDesigner::removeRecursiveEventFilter(TQObject *object, TQObject *container) { object->removeEventFilter(container); if(!object->isWidgetType()) return; - if(!object->children()) + TQObjectList list = object->childrenListObject(); + if(list.isEmpty()) return; - QObjectList list = *(object->children()); - for(QObject *obj = list.first(); obj; obj = list.next()) + for(TQObject *obj = list.first(); obj; obj = list.next()) removeRecursiveEventFilter(obj, container); } void -KFormDesigner::setRecursiveCursor(QWidget *w, Form *form) +KFormDesigner::setRecursiveCursor(TQWidget *w, Form *form) { ObjectTreeItem *tree = form->objectTree()->lookup(w->name()); - if(tree && ((tree->modifiedProperties()->contains("cursor")) || !tree->children()->isEmpty()) - && !w->inherits("QLineEdit") && !w->inherits("QTextEdit") + if(tree && ((tree->modifiedProperties()->tqcontains("cursor")) || !tree->tqchildren()->isEmpty()) + && !w->inherits(TQLINEEDIT_OBJECT_NAME_STRING) && !w->inherits(TQTEXTEDIT_OBJECT_NAME_STRING) ) //fix weird behaviour return; // if the user has set a cursor for this widget or this is a container, don't change it if(w->ownCursor()) - w->setCursor(Qt::ArrowCursor); + w->setCursor(TQt::ArrowCursor); - QObjectList *l = w->queryList( "QWidget" ); - for(QObject *o = l->first(); o; o = l->next()) - ((QWidget*)o)->setCursor(Qt::ArrowCursor); + TQObjectList *l = w->queryList( TQWIDGET_OBJECT_NAME_STRING ); + for(TQObject *o = l->first(); o; o = l->next()) + ((TQWidget*)o)->setCursor(TQt::ArrowCursor); delete l; } -QSize -KFormDesigner::getSizeFromChildren(QWidget *w, const char *inheritClass) +TQSize +KFormDesigner::getSizeFromChildren(TQWidget *w, const char *inheritClass) { int tmpw = 0, tmph = 0; - QObjectList *list = w->queryList(inheritClass, 0, false, false); - for(QObject *o = list->first(); o; o = list->next()) { - QRect r = ((QWidget*)o)->geometry(); - tmpw = QMAX(tmpw, r.right()); - tmph = QMAX(tmph, r.bottom()); + TQObjectList *list = w->queryList(inheritClass, 0, false, false); + for(TQObject *o = list->first(); o; o = list->next()) { + TQRect r = ((TQWidget*)o)->tqgeometry(); + tmpw = TQMAX(tmpw, r.right()); + tmph = TQMAX(tmph, r.bottom()); } delete list; - return QSize(tmpw, tmph) + QSize(10, 10); + return TQSize(tmpw, tmph) + TQSize(10, 10); } // ----------------- -HorWidgetList::HorWidgetList(QWidget *topLevelWidget) +HorWidgetList::HorWidgetList(TQWidget *tqtopLevelWidget) : WidgetList() - , m_topLevelWidget(topLevelWidget) + , m_tqtopLevelWidget(tqtopLevelWidget) { } @@ -128,18 +129,18 @@ HorWidgetList::~HorWidgetList() { } -int HorWidgetList::compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2) +int HorWidgetList::compareItems(TQPtrCollection::Item item1, TQPtrCollection::Item item2) { - QWidget *w1 = static_cast<QWidget*>(item1); - QWidget *w2 = static_cast<QWidget*>(item2); - return w1->mapTo(m_topLevelWidget, QPoint(0,0)).x() - w2->mapTo(m_topLevelWidget, QPoint(0,0)).x(); + TQWidget *w1 = TQT_TQWIDGET(item1); + TQWidget *w2 = TQT_TQWIDGET(item2); + return w1->mapTo(m_tqtopLevelWidget, TQPoint(0,0)).x() - w2->mapTo(m_tqtopLevelWidget, TQPoint(0,0)).x(); } // ----------------- -VerWidgetList::VerWidgetList(QWidget *topLevelWidget) +VerWidgetList::VerWidgetList(TQWidget *tqtopLevelWidget) : WidgetList() - , m_topLevelWidget(topLevelWidget) + , m_tqtopLevelWidget(tqtopLevelWidget) { } @@ -147,37 +148,37 @@ VerWidgetList::~VerWidgetList() { } -int VerWidgetList::compareItems(QPtrCollection::Item item1, QPtrCollection::Item item2) +int VerWidgetList::compareItems(TQPtrCollection::Item item1, TQPtrCollection::Item item2) { - QWidget *w1 = static_cast<QWidget*>(item1); - QWidget *w2 = static_cast<QWidget*>(item2); + TQWidget *w1 = TQT_TQWIDGET(item1); + TQWidget *w2 = TQT_TQWIDGET(item2); int y1, y2; - QObject *page1 = 0; + TQObject *page1 = 0; TabWidget *tw1 = KFormDesigner::findParent<KFormDesigner::TabWidget>(w1, "KFormDesigner::TabWidget", page1); if (tw1) // special case - y1 = w1->mapTo(m_topLevelWidget, QPoint(0,0)).y() + tw1->tabBarHeight() -2 -2; + y1 = w1->mapTo(m_tqtopLevelWidget, TQPoint(0,0)).y() + tw1->tabBarHeight() -2 -2; else - y1 = w1->mapTo(m_topLevelWidget, QPoint(0,0)).y(); + y1 = w1->mapTo(m_tqtopLevelWidget, TQPoint(0,0)).y(); - QObject *page2 = 0; + TQObject *page2 = 0; TabWidget *tw2 = KFormDesigner::findParent<KFormDesigner::TabWidget>(w2, "KFormDesigner::TabWidget", page2); if (tw1 && tw2 && tw1 == tw2 && page1 != page2) { // this sorts widgets by tabs there're put in - return tw1->indexOf(static_cast<QWidget*>(page1)) - tw2->indexOf(static_cast<QWidget*>(page2)); + return tw1->indexOf(TQT_TQWIDGET(page1)) - tw2->indexOf(TQT_TQWIDGET(page2)); } if (tw2) // special case - y2 = w2->mapTo(m_topLevelWidget, QPoint(0,0)).y() + tw2->tabBarHeight() -2 -2; + y2 = w2->mapTo(m_tqtopLevelWidget, TQPoint(0,0)).y() + tw2->tabBarHeight() -2 -2; else - y2 = w2->mapTo(m_topLevelWidget, QPoint(0,0)).y(); + y2 = w2->mapTo(m_tqtopLevelWidget, TQPoint(0,0)).y(); kdDebug() << w1->name() << ": " << y1 << " " << " | " << w2->name() << ": " << y2 << endl; - //kdDebug() << w1->name() << ": " << w1->mapTo(m_topLevelWidget, QPoint(0,0)) << " " << w1->y() - //<< " | " << w2->name() << ":" /*<< w2->mapFrom(m_topLevelWidget, QPoint(0,w2->y()))*/ << " " << w2->y() << endl; + //kdDebug() << w1->name() << ": " << w1->mapTo(m_tqtopLevelWidget, TQPoint(0,0)) << " " << w1->y() + //<< " | " << w2->name() << ":" /*<< w2->mapFrom(m_tqtopLevelWidget, TQPoint(0,w2->y()))*/ << " " << w2->y() << endl; return y1 - y2; } |