summaryrefslogtreecommitdiffstats
path: root/kexi/formeditor/form.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/formeditor/form.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-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/form.cpp')
-rw-r--r--kexi/formeditor/form.cpp123
1 files changed, 62 insertions, 61 deletions
diff --git a/kexi/formeditor/form.cpp b/kexi/formeditor/form.cpp
index a5d57002..41afdf37 100644
--- a/kexi/formeditor/form.cpp
+++ b/kexi/formeditor/form.cpp
@@ -19,10 +19,10 @@
* Boston, MA 02110-1301, USA.
*/
-#include <qwidget.h>
-#include <qlabel.h>
-#include <qobjectlist.h>
-#include <qptrdict.h>
+#include <tqwidget.h>
+#include <tqlabel.h>
+#include <tqobjectlist.h>
+#include <tqptrdict.h>
#include <kdebug.h>
#include <klocale.h>
@@ -89,7 +89,7 @@ FormWidget::~FormWidget()
//--------------------------------------
Form::Form(WidgetLibrary* library, const char *name, bool designMode)
- : QObject(library, name)
+ : TQObject(library, name)
, m_lib(library)
{
d = new FormPrivate();
@@ -99,8 +99,8 @@ Form::Form(WidgetLibrary* library, const char *name, bool designMode)
// Init actions
d->collection = new KActionCollection(0, this);
d->history = new KCommandHistory(d->collection, true);
- connect(d->history, SIGNAL(commandExecuted()), this, SLOT(slotCommandExecuted()));
- connect(d->history, SIGNAL(documentRestored()), this, SLOT(slotFormRestored()));
+ connect(d->history, TQT_SIGNAL(commandExecuted()), this, TQT_SLOT(slotCommandExecuted()));
+ connect(d->history, TQT_SIGNAL(documentRestored()), this, TQT_SLOT(slotFormRestored()));
}
Form::~Form()
@@ -110,7 +110,7 @@ Form::~Form()
d = 0;
}
-QWidget*
+TQWidget*
Form::widget() const
{
if(d->topTree)
@@ -124,7 +124,7 @@ Form::widget() const
//////////////// Container -related functions ///////////////////////
void
-Form::createToplevel(QWidget *container, FormWidget *formWidget, const QCString &)
+Form::createToplevel(TQWidget *container, FormWidget *formWidget, const TQCString &)
{
kdDebug() << "Form::createToplevel() container= "<< (container ? container->name() : "<NULL>")
<< " formWidget=" << formWidget << "className=" << name() << endl;
@@ -141,7 +141,7 @@ Form::createToplevel(QWidget *container, FormWidget *formWidget, const QCString
// d->topTree->addModifiedProperty("caption", name());
//m_topTree->addModifiedProperty("icon");
- connect(container, SIGNAL(destroyed()), this, SLOT(formDeleted()));
+ connect(container, TQT_SIGNAL(destroyed()), this, TQT_SLOT(formDeleted()));
kdDebug() << "Form::createToplevel(): d->toplevel=" << d->toplevel << endl;
}
@@ -164,7 +164,7 @@ Form::activeContainer()
if(it->container())
return it->container();
else
- return it->parent()->container();
+ return it->tqparent()->container();
}
ObjectTreeItem*
@@ -173,11 +173,11 @@ Form::commonParentContainer(WidgetList *wlist)
ObjectTreeItem *item = 0;
WidgetList *list = new WidgetList();
- // Creates a list of all widget parents
- for(QWidget *w = wlist->first(); w; w = wlist->next())
+ // Creates a list of all widget tqparents
+ for(TQWidget *w = wlist->first(); w; w = wlist->next())
{
- if(list->findRef(w->parentWidget()) == -1)
- list->append(w->parentWidget());
+ if(list->tqfindRef(w->tqparentWidget()) == -1)
+ list->append(w->tqparentWidget());
}
removeChildrenFromList(*list);
@@ -193,7 +193,7 @@ Form::commonParentContainer(WidgetList *wlist)
}
Container*
-Form::parentContainer(QWidget *w)
+Form::tqparentContainer(TQWidget *w)
{
ObjectTreeItem *it;
if(!w)
@@ -202,10 +202,10 @@ Form::parentContainer(QWidget *w)
//else
it = d->topTree->lookup(w->name());
- if(it->parent()->container())
- return it->parent()->container();
+ if(it->tqparent()->container())
+ return it->tqparent()->container();
else
- return it->parent()->parent()->container();
+ return it->tqparent()->tqparent()->container();
}
@@ -234,7 +234,7 @@ Form::setDesignMode(bool design)
///////////////////////////// Selection stuff ///////////////////////
void
-Form::setSelectedWidget(QWidget *w, bool add, bool dontRaise, bool moreWillBeSelected)
+Form::setSelectedWidget(TQWidget *w, bool add, bool dontRaise, bool moreWillBeSelected)
{
if((d->selected.isEmpty()) || (w == widget()) || (d->selected.first() == widget()))
add = false;
@@ -245,14 +245,14 @@ Form::setSelectedWidget(QWidget *w, bool add, bool dontRaise, bool moreWillBeSel
return;
}
- //raise selected widget and all possible parents
- QWidget *wtmp = w;
- while(!dontRaise && wtmp && wtmp->parentWidget() && (wtmp != widget()))
+ //raise selected widget and all possible tqparents
+ TQWidget *wtmp = w;
+ while(!dontRaise && wtmp && wtmp->tqparentWidget() && (wtmp != widget()))
{
wtmp->raise();
if(d->resizeHandles[ wtmp->name() ])
d->resizeHandles[ wtmp->name() ]->raise();
- wtmp = wtmp->parentWidget();
+ wtmp = wtmp->tqparentWidget();
}
if (wtmp)
@@ -267,12 +267,12 @@ Form::setSelectedWidget(QWidget *w, bool add, bool dontRaise, bool moreWillBeSel
emit selectionChanged(w, add, moreWillBeSelected);
emitActionSignals(false);
- // WidgetStack and TabWidget pages widgets shouldn't have resize handles, but their parent
- if(!FormManager::self()->isTopLevel(w) && w->parentWidget() && w->parentWidget()->isA("QWidgetStack"))
+ // WidgetStack and TabWidget pages widgets shouldn't have resize handles, but their tqparent
+ if(!FormManager::self()->isTopLevel(w) && w->tqparentWidget() && w->tqparentWidget()->isA(TQWIDGETSTACK_OBJECT_NAME_STRING))
{
- w = w->parentWidget();
- if(w->parentWidget() && w->parentWidget()->inherits("QTabWidget"))
- w = w->parentWidget();
+ w = w->tqparentWidget();
+ if(w->tqparentWidget() && w->tqparentWidget()->inherits(TQTABWIDGET_OBJECT_NAME_STRING))
+ w = w->tqparentWidget();
}
if(w && w != widget())
@@ -280,13 +280,13 @@ Form::setSelectedWidget(QWidget *w, bool add, bool dontRaise, bool moreWillBeSel
}
ResizeHandleSet*
-Form::resizeHandlesForWidget(QWidget* w)
+Form::resizeHandlesForWidget(TQWidget* w)
{
return d->resizeHandles[w->name()];
}
void
-Form::unSelectWidget(QWidget *w)
+Form::unSelectWidget(TQWidget *w)
{
d->selected.remove(w);
d->resizeHandles.remove(w->name());
@@ -334,7 +334,7 @@ void
Form::emitSelectionSignals()
{
emit selectionChanged(selectedWidgets()->first(), false);
-// for(QWidget *w = selectedWidgets()->next(); w; w = selectedWidgets()->next())
+// for(TQWidget *w = selectedWidgets()->next(); w; w = selectedWidgets()->next())
// emit selectionChanged(selectedWidgets()->first(), true);
for (WidgetListIterator it(*selectedWidgets()); it.current(); ++it)
emit selectionChanged(it.current(), true);
@@ -358,20 +358,20 @@ Form::formDeleted()
}
void
-Form::changeName(const QCString &oldname, const QCString &newname)
+Form::changeName(const TQCString &oldname, const TQCString &newname)
{
if(oldname == newname)
return;
if(!d->topTree->rename(oldname, newname)) // rename failed
{
- KMessageBox::sorry(widget()->topLevelWidget(),
- i18n("Renaming widget \"%1\" to \"%2\" failed.").arg(oldname).arg(newname));
+ KMessageBox::sorry(widget()->tqtopLevelWidget(),
+ i18n("Renaming widget \"%1\" to \"%2\" failed.").tqarg(TQString(oldname)).tqarg(TQString(newname)));
//moved to WidgetPropertySet::slotChangeProperty()
-// KMessageBox::sorry(widget()->topLevelWidget(),
+// KMessageBox::sorry(widget()->tqtopLevelWidget(),
// i18n("A widget with this name already exists. "
// "Please choose another name or rename existing widget."));
kdDebug() << "Form::changeName() : ERROR : A widget named " << newname << " already exists" << endl;
- FormManager::self()->propertySet()->property("name") = QVariant(oldname);
+ FormManager::self()->propertySet()->property("name") = TQVariant(oldname);
}
else
{
@@ -411,8 +411,8 @@ void
Form::clearCommandHistory()
{
d->history->clear();
- FormManager::self()->emitUndoEnabled(false, QString::null);
- FormManager::self()->emitRedoEnabled(false, QString::null);
+ FormManager::self()->emitUndoEnabled(false, TQString());
+ FormManager::self()->emitRedoEnabled(false, TQString());
}
void
@@ -421,8 +421,8 @@ Form::slotCommandExecuted()
emit FormManager::self()->dirty(this, true);
d->dirty = true;
// because actions text is changed after the commandExecuted() signal is emitted
- QTimer::singleShot(10, this, SLOT(emitUndoEnabled()));
- QTimer::singleShot(10, this, SLOT(emitRedoEnabled()));
+ TQTimer::singleShot(10, this, TQT_SLOT(emitUndoEnabled()));
+ TQTimer::singleShot(10, this, TQT_SLOT(emitRedoEnabled()));
}
void
@@ -454,24 +454,25 @@ Form::slotFormRestored()
void
Form::addWidgetToTabStops(ObjectTreeItem *it)
{
- QWidget *w = it->widget();
+ TQWidget *w = it->widget();
if(!w)
return;
- if(!(w->focusPolicy() & QWidget::TabFocus))
+ if(!(w->focusPolicy() & TQ_TabFocus))
{
- if (!w->children())
+ TQObjectList clo = w->childrenListObject();
+ if (clo.isEmpty())
return;
// For composed widgets, we check if one of the child can have focus
- for(QObjectListIterator chIt(*w->children()); chIt.current(); ++chIt) {
- if(chIt.current()->isWidgetType()) {//QWidget::TabFocus flag will be checked later!
- if(d->tabstops.findRef(it) == -1) {
+ for(TQObjectListIterator chIt(clo); chIt.current(); ++chIt) {
+ if(chIt.current()->isWidgetType()) {//TQ_TabFocus flag will be checked later!
+ if(d->tabstops.tqfindRef(it) == -1) {
d->tabstops.append(it);
return;
}
}
}
}
- else if(d->tabstops.findRef(it) == -1) // not yet in the list
+ else if(d->tabstops.tqfindRef(it) == -1) // not yet in the list
d->tabstops.append(it);
}
@@ -479,7 +480,7 @@ void
Form::updateTabStopsOrder()
{
for (ObjectTreeListIterator it(d->tabstops);it.current();) {
- if(!(it.current()->widget()->focusPolicy() & QWidget::TabFocus)) {
+ if(!(it.current()->widget()->focusPolicy() & TQ_TabFocus)) {
kexidbg << "Form::updateTabStopsOrder(): widget removed because has no TabFocus: " << it.current()->widget()->name() << endl;
d->tabstops.remove( it.current() );
}
@@ -489,7 +490,7 @@ Form::updateTabStopsOrder()
}
//! Collects all the containers reculsively. Used by Form::autoAssignTabStops().
-void collectContainers(ObjectTreeItem* item, QPtrDict<char>& containers)
+void collectContainers(ObjectTreeItem* item, TQPtrDict<char>& containers)
{
if (!item->container())
return;
@@ -498,7 +499,7 @@ void collectContainers(ObjectTreeItem* item, QPtrDict<char>& containers)
<< " " << item->container()->objectTree()->name() << endl;
containers.insert( item->container(), (const char *)1 );
}
- for (ObjectTreeListIterator it(*item->children()); it.current(); ++it)
+ for (ObjectTreeListIterator it(*item->tqchildren()); it.current(); ++it)
collectContainers(it.current(), containers);
}
@@ -509,7 +510,7 @@ Form::autoAssignTabStops()
HorWidgetList hlist(toplevelContainer()->widget());
// 1. Collect all the containers, as we'll be sorting widgets groupped by containers
- QPtrDict<char> containers;
+ TQPtrDict<char> containers;
collectContainers( toplevelContainer()->objectTree(), containers );
@@ -521,29 +522,29 @@ Form::autoAssignTabStops()
}
list.sort();
- foreach_list(QPtrListIterator<QWidget>, iter, list)
+ foreach_list(TQPtrListIterator<TQWidget>, iter, list)
kdDebug() << iter.current()->className() << " " << iter.current()->name() << endl;
d->tabstops.clear();
/// We automatically sort widget from the top-left to bottom-right corner
- //! \todo Handle RTL layout (ie from top-right to bottom-left)
+ //! \todo Handle RTL tqlayout (ie from top-right to bottom-left)
foreach_list(WidgetListIterator, it, list) {
- QWidget *w = it.current();
+ TQWidget *w = it.current();
hlist.append(w);
++it;
- QWidget *nextw = it.current();
- QObject *page_w = 0;
- KFormDesigner::TabWidget *tab_w = KFormDesigner::findParent<KFormDesigner::TabWidget>(w, "KFormDesigner::TabWidget", page_w);
+ TQWidget *nextw = it.current();
+ TQObject *page_w = 0;
+ KFormDesigner::TabWidget *tab_w = KFormDesigner::findParent<KFormDesigner::TabWidget>(TQT_TQOBJECT(w), "KFormDesigner::TabWidget", page_w);
while (nextw) {
- if (KexiUtils::hasParent(w, nextw)) // do not group (sort) widgets where on is a child of another
+ if (KexiUtils::hasParent(TQT_TQOBJECT(w), TQT_TQOBJECT(nextw))) // do not group (sort) widgets where on is a child of another
break;
if (nextw->y() >= (w->y() + 20))
break;
if (tab_w) {
- QObject *page_nextw = 0;
- KFormDesigner::TabWidget *tab_nextw = KFormDesigner::findParent<KFormDesigner::TabWidget>(nextw, "KFormDesigner::TabWidget", page_nextw);
+ TQObject *page_nextw = 0;
+ KFormDesigner::TabWidget *tab_nextw = KFormDesigner::findParent<KFormDesigner::TabWidget>(TQT_TQOBJECT(nextw), "KFormDesigner::TabWidget", page_nextw);
if (tab_w == tab_nextw) {
if (page_w != page_nextw) // 'nextw' widget within different tab page
break;