diff options
Diffstat (limited to 'lib/koproperty/editor.cpp')
-rw-r--r-- | lib/koproperty/editor.cpp | 316 |
1 files changed, 158 insertions, 158 deletions
diff --git a/lib/koproperty/editor.cpp b/lib/koproperty/editor.cpp index 3ae52d40f..d664b6b89 100644 --- a/lib/koproperty/editor.cpp +++ b/lib/koproperty/editor.cpp @@ -26,17 +26,17 @@ #include "property.h" #include "widget.h" -#include <qpushbutton.h> -#include <qlayout.h> -#include <qmap.h> -#include <qguardedptr.h> -#include <qheader.h> -#include <qasciidict.h> -#include <qtooltip.h> -#include <qapplication.h> -#include <qeventloop.h> -#include <qtimer.h> -#include <qlabel.h> +#include <tqpushbutton.h> +#include <tqlayout.h> +#include <tqmap.h> +#include <tqguardedptr.h> +#include <tqheader.h> +#include <tqasciidict.h> +#include <tqtooltip.h> +#include <tqapplication.h> +#include <tqeventloop.h> +#include <tqtimer.h> +#include <tqlabel.h> #include <kdebug.h> #include <kiconloader.h> @@ -49,14 +49,14 @@ namespace KoProperty { //! @internal static bool kofficeAppDirAdded = false; -//! \return true if \a o has parent \a par. +//! \return true if \a o has tqparent \a par. //! @internal -inline bool hasParent(QObject* par, QObject* o) +inline bool hasParent(TQObject* par, TQObject* o) { if (!o || !par) return false; while (o && o != par) - o = o->parent(); + o = o->tqparent(); return o == par; } @@ -77,20 +77,20 @@ class EditorPrivate previouslyCollapsedGroupItem = 0; childFormPreviouslyCollapsedGroupItem = 0; slotPropertyChanged_enabled = true; - QObject::connect(&changeSetLaterTimer, SIGNAL(timeout()), - editor, SLOT(changeSetLater())); + TQObject::connect(&changeSetLaterTimer, TQT_SIGNAL(timeout()), + editor, TQT_SLOT(changeSetLater())); } ~EditorPrivate() { } - QGuardedPtr<Set> set; + TQGuardedPtr<Set> set; //! widget cache for property types, widget will be deleted - QMap<Property*, Widget* > widgetCache; - QGuardedPtr<Widget> currentWidget; + TQMap<Property*, Widget* > widgetCache; + TQGuardedPtr<Widget> currentWidget; EditorItem *currentItem; EditorItem *topItem; //! The top item is used to control the drawing of every branches. - QPushButton *undoButton; //! "Revert to defaults" button + TQPushButton *undoButton; //! "Revert to defaults" button EditorItem::Dict itemDict; int baseRowHeight; @@ -98,10 +98,10 @@ class EditorPrivate bool insideSlotValueChanged : 1; //! Helpers for changeSetLater() - QTimer changeSetLaterTimer; + TQTimer changeSetLaterTimer; bool setListLater_set : 1; bool preservePrevSelection_preservePrevSelection : 1; - QCString preservePrevSelection_propertyToSelect; + TQCString preservePrevSelection_propertyToSelect; //bool doNotSetFocusOnSelection : 1; //! Used in setFocus() to prevent scrolling to previously selected item on mouse click bool justClickedItem : 1; @@ -112,15 +112,15 @@ class EditorPrivate //! used by selectItemLater() EditorItem *itemToSelectLater; - QListViewItem *previouslyCollapsedGroupItem; - QListViewItem *childFormPreviouslyCollapsedGroupItem; + TQListViewItem *previouslyCollapsedGroupItem; + TQListViewItem *childFormPreviouslyCollapsedGroupItem; }; } using namespace KoProperty; -Editor::Editor(QWidget *parent, bool autoSync, const char *name) - : KListView(parent, name) +Editor::Editor(TQWidget *tqparent, bool autoSync, const char *name) + : KListView(tqparent, name) { d = new EditorPrivate(this); d->itemDict.setAutoDelete(false); @@ -134,14 +134,14 @@ Editor::Editor(QWidget *parent, bool autoSync, const char *name) d->preservePrevSelection_preservePrevSelection = false; d->setListLater_list = 0; - d->undoButton = new QPushButton(viewport()); - d->undoButton->setFocusPolicy(QWidget::NoFocus); - setFocusPolicy(QWidget::ClickFocus); - d->undoButton->setMinimumSize(QSize(5,5)); // allow to resize undoButton even below pixmap size + d->undoButton = new TQPushButton(viewport()); + d->undoButton->setFocusPolicy(TQ_NoFocus); + setFocusPolicy(TQ_ClickFocus); + d->undoButton->setMinimumSize(TQSize(5,5)); // allow to resize undoButton even below pixmap size d->undoButton->setPixmap(SmallIcon("undo")); - QToolTip::add(d->undoButton, i18n("Undo changes")); + TQToolTip::add(d->undoButton, i18n("Undo changes")); d->undoButton->hide(); - connect(d->undoButton, SIGNAL(clicked()), this, SLOT(undo())); + connect(d->undoButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(undo())); installEventFilter(this); viewport()->installEventFilter(this); @@ -149,7 +149,7 @@ Editor::Editor(QWidget *parent, bool autoSync, const char *name) addColumn(i18n("Name")); addColumn(i18n("Value")); setAllColumnsShowFocus(true); - setColumnWidthMode(0, QListView::Maximum); + setColumnWidthMode(0, TQListView::Maximum); setFullWidth(true); setShowSortIndicator(false); #if KDE_IS_VERSION(3,3,9) @@ -162,16 +162,16 @@ Editor::Editor(QWidget *parent, bool autoSync, const char *name) setTreeStepSize(16 + 2/*left*/ + 1/*right*/); updateFont(); -// d->baseRowHeight = QFontMetrics(font()).height() + itemMargin()*2; - - connect(this, SIGNAL(selectionChanged(QListViewItem *)), this, SLOT(slotClicked(QListViewItem *))); - connect(this, SIGNAL(currentChanged(QListViewItem *)), this, SLOT(slotCurrentChanged(QListViewItem *))); - connect(this, SIGNAL(expanded(QListViewItem *)), this, SLOT(slotExpanded(QListViewItem *))); - connect(this, SIGNAL(collapsed(QListViewItem *)), this, SLOT(slotCollapsed(QListViewItem *))); - connect(header(), SIGNAL(sizeChange(int, int, int)), this, SLOT(slotColumnSizeChanged(int, int, int))); -// connect(header(), SIGNAL(clicked(int)), this, SLOT(updateEditorGeometry())); -// connect(header(), SIGNAL(clicked(int)), this, SLOT(updateEditorGeometryAndGroupLabels())); - connect(header(), SIGNAL(sectionHandleDoubleClicked (int)), this, SLOT(slotColumnSizeChanged(int))); +// d->baseRowHeight = TQFontMetrics(font()).height() + itemMargin()*2; + + connect(this, TQT_SIGNAL(selectionChanged(TQListViewItem *)), this, TQT_SLOT(slotClicked(TQListViewItem *))); + connect(this, TQT_SIGNAL(currentChanged(TQListViewItem *)), this, TQT_SLOT(slotCurrentChanged(TQListViewItem *))); + connect(this, TQT_SIGNAL(expanded(TQListViewItem *)), this, TQT_SLOT(slotExpanded(TQListViewItem *))); + connect(this, TQT_SIGNAL(collapsed(TQListViewItem *)), this, TQT_SLOT(slotCollapsed(TQListViewItem *))); + connect(header(), TQT_SIGNAL(sizeChange(int, int, int)), this, TQT_SLOT(slotColumnSizeChanged(int, int, int))); +// connect(header(), TQT_SIGNAL(clicked(int)), this, TQT_SLOT(updateEditorGeometry())); +// connect(header(), TQT_SIGNAL(clicked(int)), this, TQT_SLOT(updateEditorGeometryAndGroupLabels())); + connect(header(), TQT_SIGNAL(sectionHandleDoubleClicked (int)), this, TQT_SLOT(slotColumnSizeChanged(int))); updateGroupLabelsPosition(); } @@ -187,7 +187,7 @@ Editor::fill() { setUpdatesEnabled(false); d->itemToSelectLater = 0; - qApp->eventLoop()->processEvents(QEventLoop::AllEvents); + tqApp->eventLoop()->processEvents(TQEventLoop::AllEvents); hideEditor(); KListView::clear(); d->itemDict.clear(); @@ -201,22 +201,22 @@ Editor::fill() d->topItem = new EditorDummyItem(this); - const QValueList<QCString> groupNames = d->set->groupNames(); + const TQValueList<TQCString> groupNames = d->set->groupNames(); // kopropertydbg << "Editor::fill(): group names = " << groupNames.count() << endl; if(groupNames.count() == 1) { // one group (default one), so don't show groups //add flat set of properties - const QValueList<QCString>& propertyNames = d->set->propertyNamesForGroup( groupNames.first() ); - QValueListConstIterator<QCString> it = propertyNames.constBegin(); + const TQValueList<TQCString>& propertyNames = d->set->propertyNamesForGroup( groupNames.first() ); + TQValueListConstIterator<TQCString> it = propertyNames.constBegin(); for( ; it != propertyNames.constEnd(); ++it) addItem(*it, d->topItem); } else { // create a groupItem for each group EditorGroupItem *prevGroupItem = 0; int sortOrder = 0; - for (QValueListConstIterator<QCString> it = groupNames.constBegin(); it!=groupNames.constEnd(); + for (TQValueListConstIterator<TQCString> it = groupNames.constBegin(); it!=groupNames.constEnd(); ++it, sortOrder++) { - const QValueList<QCString>& propertyNames = d->set->propertyNamesForGroup(*it); + const TQValueList<TQCString>& propertyNames = d->set->propertyNamesForGroup(*it); EditorGroupItem *groupItem; if (prevGroupItem) groupItem = new EditorGroupItem(d->topItem, prevGroupItem, @@ -225,7 +225,7 @@ Editor::fill() groupItem = new EditorGroupItem(d->topItem, d->set->groupDescription(*it), d->set->groupIcon(*it), sortOrder ); - QValueList<QCString>::ConstIterator it2 = propertyNames.constBegin(); + TQValueList<TQCString>::ConstIterator it2 = propertyNames.constBegin(); for( ; it2 != propertyNames.constEnd(); ++it2) addItem(*it2, groupItem); @@ -233,7 +233,7 @@ Editor::fill() } } -// repaint(); +// tqrepaint(); if (firstChild()) { @@ -248,9 +248,9 @@ Editor::fill() } void -Editor::addItem(const QCString &name, EditorItem *parent) +Editor::addItem(const TQCString &name, EditorItem *tqparent) { - if(!d->set || !d->set->contains(name)) + if(!d->set || !d->set->tqcontains(name)) return; Property *property = &(d->set->property(name)); @@ -258,25 +258,25 @@ Editor::addItem(const QCString &name, EditorItem *parent) // kopropertydbg << "Property is not visible: " << name << endl; return; } - QListViewItem *last = parent ? parent->firstChild() : d->topItem->firstChild(); + TQListViewItem *last = tqparent ? tqparent->firstChild() : d->topItem->firstChild(); while(last && last->nextSibling()) last = last->nextSibling(); EditorItem *item=0; - if(parent) - item = new EditorItem(this, parent, property, last); + if(tqparent) + item = new EditorItem(this, tqparent, property, last); else item = new EditorItem(this, d->topItem, property, last); d->itemDict.insert(name, item); // Create child items item->setOpen(true); - if(!property->children()) + if(!property->tqchildren()) return; last = 0; - QValueList<Property*>::ConstIterator endIt = property->children()->constEnd(); - for(QValueList<Property*>::ConstIterator it = property->children()->constBegin(); it != endIt; ++it) { + TQValueList<Property*>::ConstIterator endIt = property->tqchildren()->constEnd(); + for(TQValueList<Property*>::ConstIterator it = property->tqchildren()->constBegin(); it != endIt; ++it) { //! \todo allow to have child prop with child items too if( *it && (*it)->isVisible() ) last = new EditorItem(this, item, *it, last); @@ -290,13 +290,13 @@ Editor::changeSet(Set *set, bool preservePrevSelection) } void -Editor::changeSet(Set *set, const QCString& propertyToSelect) +Editor::changeSet(Set *set, const TQCString& propertyToSelect) { changeSetInternal(set, !propertyToSelect.isEmpty(), propertyToSelect); } void -Editor::changeSetInternal(Set *set, bool preservePrevSelection, const QCString& propertyToSelect) +Editor::changeSetInternal(Set *set, bool preservePrevSelection, const TQCString& propertyToSelect) { if (d->insideSlotValueChanged) { //changeSet() called from inside of slotValueChanged() @@ -305,7 +305,7 @@ Editor::changeSetInternal(Set *set, bool preservePrevSelection, const QCString& d->setListLater_list = set; d->preservePrevSelection_preservePrevSelection = preservePrevSelection; d->preservePrevSelection_propertyToSelect = propertyToSelect; - qApp->eventLoop()->processEvents(QEventLoop::AllEvents); + tqApp->eventLoop()->processEvents(TQEventLoop::AllEvents); if (d->set) { //store prev. selection for this prop set if (d->currentItem) @@ -329,7 +329,7 @@ Editor::changeSetInternal(Set *set, bool preservePrevSelection, const QCString& d->set->disconnect(this); } - QCString selectedPropertyName1 = propertyToSelect, selectedPropertyName2 = propertyToSelect; + TQCString selectedPropertyName1 = propertyToSelect, selectedPropertyName2 = propertyToSelect; if (preservePrevSelection) { //try to find prev. selection: //1. in new list's prev. selection @@ -343,12 +343,12 @@ Editor::changeSetInternal(Set *set, bool preservePrevSelection, const QCString& d->set = set; if (d->set) { //receive property changes - connect(d->set, SIGNAL(propertyChangedInternal(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,SIGNAL(aboutToBeCleared()), this, SLOT(slotSetWillBeCleared())); - connect(d->set,SIGNAL(aboutToBeDeleted()), this, SLOT(slotSetWillBeDeleted())); + connect(d->set, TQT_SIGNAL(propertyChangedInternal(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&))); + connect(d->set,TQT_SIGNAL(aboutToBeCleared()), this, TQT_SLOT(slotSetWillBeCleared())); + connect(d->set,TQT_SIGNAL(aboutToBeDeleted()), this, TQT_SLOT(slotSetWillBeDeleted())); } fill(); @@ -365,8 +365,8 @@ Editor::changeSetInternal(Set *set, bool preservePrevSelection, const QCString& if (item) { d->itemToSelectLater = item; - QTimer::singleShot(10, this, SLOT(selectItemLater())); - //d->doNotSetFocusOnSelection = !hasParent(this, focusWidget()); + TQTimer::singleShot(10, this, TQT_SLOT(selectItemLater())); + //d->doNotSetFocusOnSelection = !hasParent(this, tqfocusWidget()); //setSelected(item, true); //d->doNotSetFocusOnSelection = false; // ensureItemVisible(item); @@ -389,7 +389,7 @@ void Editor::selectItemLater() void Editor::changeSetLater() { - qApp->eventLoop()->processEvents(QEventLoop::AllEvents); + tqApp->eventLoop()->processEvents(TQEventLoop::AllEvents); if (kapp->hasPendingEvents()) { d->changeSetLaterTimer.start(10, true); //try again... return; @@ -412,7 +412,7 @@ Editor::clear(bool editorOnly) hideEditor(); if(!editorOnly) { - qApp->eventLoop()->processEvents(QEventLoop::AllEvents); + tqApp->eventLoop()->processEvents(TQEventLoop::AllEvents); if(d->set) d->set->disconnect(this); clearWidgetCache(); @@ -436,7 +436,7 @@ Editor::undo() d->currentItem->property()->resetValue(); if (d->currentWidget && d->currentItem) {//(check because current widget could be removed by resetValue()) d->currentWidget->setValue( d->currentItem->property()->value()); - repaintItem(d->currentItem); + tqrepaintItem(d->currentItem); } } @@ -450,33 +450,33 @@ Editor::slotPropertyChanged(Set& set, Property& property) if (d->currentItem && d->currentItem->property() == &property) { d->currentWidget->setValue(property.value(), false); - for(QListViewItem *item = d->currentItem->firstChild(); item; item = item->nextSibling()) - repaintItem(item); + for(TQListViewItem *item = d->currentItem->firstChild(); item; item = item->nextSibling()) + tqrepaintItem(item); } else { // prop not in the dict, might be a child property: EditorItem *item = d->itemDict[property.name()]; - if(!item && property.parent()) - item = d->itemDict[property.parent()->name()]; + if(!item && property.tqparent()) + item = d->itemDict[property.tqparent()->name()]; if (item) { - repaintItem(item); - for(QListViewItem *it = item->firstChild(); it; it = it->nextSibling()) - repaintItem(it); + tqrepaintItem(item); + for(TQListViewItem *it = item->firstChild(); it; it = it->nextSibling()) + tqrepaintItem(it); } } //! @todo should we move this somewhere? #if 0 - if (property.parent() && property.parent()->type()==Rect) { + if (property.tqparent() && property.tqparent()->type()==Rect) { const int delta = property.value().toInt()-previousValue.toInt(); if (property.type()==Rect_X) { //|| property.type()==Rect_Y) - property.parent()->child("width")->setValue(delta, false); + property.tqparent()->child("width")->setValue(delta, false); } -/* if (widget->property() && (QWidget*)d->currentWidget==widget && d->currentItem->parent()) { - EditorItem *parentItem = static_cast<EditorItem*>(d->currentItem->parent()); +/* if (widget->property() && (TQWidget*)d->currentWidget==widget && d->currentItem->tqparent()) { + EditorItem *tqparentItem = static_cast<EditorItem*>(d->currentItem->tqparent()); const int thisType = ; - && parentItem->property()->type()==Rect) { + && tqparentItem->property()->type()==Rect) { //changing x or y components of Rect type shouldn't change width or height, respectively if (thisType==Rect_X) { EditorItem *rectWidthItem = static_cast<EditorItem*>(d->currentItem->nextSibling()->nextSibling()); @@ -498,18 +498,18 @@ Editor::slotPropertyReset(Set& set, Property& property) if (d->currentItem && d->currentItem->property() == &property) { d->currentWidget->setValue(property.value(), false); - for(QListViewItem *item = d->currentItem->firstChild(); item; item = item->nextSibling()) - repaintItem(item); + for(TQListViewItem *item = d->currentItem->firstChild(); item; item = item->nextSibling()) + tqrepaintItem(item); } else { EditorItem *item = d->itemDict[property.name()]; // prop not in the dict, might be a child prop. - if(!item && property.parent()) - item = d->itemDict[property.parent()->name()]; + if(!item && property.tqparent()) + item = d->itemDict[property.tqparent()->name()]; if (item) { - repaintItem(item); - for(QListViewItem *it = item->firstChild(); it; it = it->nextSibling()) - repaintItem(it); + tqrepaintItem(item); + for(TQListViewItem *it = item->firstChild(); it; it = it->nextSibling()) + tqrepaintItem(it); } } @@ -524,14 +524,14 @@ Editor::slotWidgetValueChanged(Widget *widget) d->insideSlotValueChanged = true; - QVariant value = widget->value(); + TQVariant value = widget->value(); int propertySync = widget->property()->autoSync(); bool sync = (propertySync != 0 && propertySync != 1) ? d->sync : (propertySync!=0); if(sync) { d->slotPropertyChanged_enabled = false; - QGuardedPtr<Widget> pWidget = widget; //safe, widget can be destroyed in the meantime + TQGuardedPtr<Widget> pWidget = widget; //safe, widget can be destroyed in the meantime widget->property()->setValue(value); if (pWidget) showUndoButton( pWidget->property()->isModified() ); @@ -566,7 +566,7 @@ Editor::slotWidgetRejectInput(Widget *widget) } void -Editor::slotClicked(QListViewItem *it) +Editor::slotClicked(TQListViewItem *it) { d->previouslyCollapsedGroupItem = 0; d->childFormPreviouslyCollapsedGroupItem = 0; @@ -590,7 +590,7 @@ Editor::slotClicked(QListViewItem *it) if (d->currentWidget) { if (d->currentWidget->visibleFlag()) { d->currentWidget->show(); - if (hasParent( this, kapp->focusWidget() )) + if (hasParent( TQT_TQOBJECT(this), TQT_TQOBJECT(kapp->tqfocusWidget()) )) d->currentWidget->setFocus(); } } @@ -599,10 +599,10 @@ Editor::slotClicked(QListViewItem *it) } void -Editor::slotCurrentChanged(QListViewItem *item) +Editor::slotCurrentChanged(TQListViewItem *item) { if (item == firstChild()) { - QListViewItem *oldItem = item; + TQListViewItem *oldItem = item; while (item && (!item->isSelectable() || !item->isVisible())) item = item->itemBelow(); if (item && item != oldItem) { @@ -634,7 +634,7 @@ Widget* Editor::createWidgetForProperty(Property *property, bool changeWidgetProperty) { // int type = property->type(); - QGuardedPtr<Widget> widget = d->widgetCache[property]; + TQGuardedPtr<Widget> widget = d->widgetCache[property]; if(!widget) { widget = FactoryManager::self()->createWidgetForProperty(property); @@ -644,15 +644,15 @@ Editor::createWidgetForProperty(Property *property, bool changeWidgetProperty) d->widgetCache[property] = widget; widget->setProperty(0); // to force reloading property later widget->hide(); - connect(widget, SIGNAL(valueChanged(Widget*)), - this, SLOT(slotWidgetValueChanged(Widget*)) ); - connect(widget, SIGNAL(acceptInput(Widget*)), - this, SLOT(slotWidgetAcceptInput(Widget*)) ); - connect(widget, SIGNAL(rejectInput(Widget*)), - this, SLOT(slotWidgetRejectInput(Widget*)) ); + connect(widget, TQT_SIGNAL(valueChanged(Widget*)), + this, TQT_SLOT(slotWidgetValueChanged(Widget*)) ); + connect(widget, TQT_SIGNAL(acceptInput(Widget*)), + this, TQT_SLOT(slotWidgetAcceptInput(Widget*)) ); + connect(widget, TQT_SIGNAL(rejectInput(Widget*)), + this, TQT_SLOT(slotWidgetRejectInput(Widget*)) ); } - //update geometry earlier, because Widget::setValue() can depend on widget's geometry + //update tqgeometry earlier, because Widget::setValue() can depend on widget's tqgeometry updateEditorGeometry(d->currentItem, widget); if(widget && (!widget->property() || changeWidgetProperty)) @@ -669,7 +669,7 @@ Editor::createWidgetForProperty(Property *property, bool changeWidgetProperty) void Editor::clearWidgetCache() { - for(QMap<Property*, Widget*>::iterator it = d->widgetCache.begin(); it != d->widgetCache.end(); ++it) + for(TQMap<Property*, Widget*>::iterator it = d->widgetCache.begin(); it != d->widgetCache.end(); ++it) it.data()->deleteLater(); // delete it.data(); d->widgetCache.clear(); @@ -695,7 +695,7 @@ Editor::updateEditorGeometry(EditorItem *item, Widget* widget, else placeForUndoButton = widget->leavesTheSpaceForRevertButton() ? d->undoButton->width() : 0; - QRect r; + TQRect r; int y = itemPos(item); r.setX(header()->sectionPos(1)-(widget->hasBorders()?1:0)); //-1, to align to horizontal line r.setY(y-(widget->hasBorders()?1:0)); @@ -709,7 +709,7 @@ Editor::updateEditorGeometry(EditorItem *item, Widget* widget, moveChild(widget, r.x(), r.y()); widget->resize(r.size()); - qApp->eventLoop()->processEvents(QEventLoop::AllEvents); + tqApp->eventLoop()->processEvents(TQEventLoop::AllEvents); } void @@ -720,10 +720,10 @@ Editor::updateGroupLabelsPosition() EditorGroupItem *group = dynamic_cast<EditorGroupItem*>(d->topItem->firstChild()); while(group) { - QRect r = itemRect((QListViewItem*) group); + TQRect r = tqitemRect((TQListViewItem*) group); if(group->label()) { group->label()->setGeometry(r); - group->label()->repaint(); + group->label()->tqrepaint(); } group = dynamic_cast<EditorGroupItem*>(group->nextSibling()); } @@ -733,7 +733,7 @@ void Editor::hideEditor() { d->currentItem = 0; - QWidget *cw = d->currentWidget; + TQWidget *cw = d->currentWidget; if(cw) { d->currentWidget = 0; cw->hide(); @@ -747,8 +747,8 @@ Editor::showUndoButton( bool show ) if (!d->currentItem || !d->currentWidget || (d->currentWidget && d->currentWidget->isReadOnly())) return; - int y = viewportToContents(QPoint(0, itemRect(d->currentItem).y())).y(); - QRect geometry(columnWidth(0), y, columnWidth(1) + 1, d->currentItem->height()); + int y = viewportToContents(TQPoint(0, tqitemRect(d->currentItem).y())).y(); + TQRect tqgeometry(columnWidth(0), y, columnWidth(1) + 1, d->currentItem->height()); d->undoButton->resize(d->baseRowHeight, d->currentItem->height()); updateEditorGeometry(true, show); @@ -756,27 +756,27 @@ Editor::showUndoButton( bool show ) if (!show) { /* if (d->currentWidget) { if (d->currentWidget->leavesTheSpaceForRevertButton()) { - geometry.setWidth(geometry.width()-d->undoButton->width()); + tqgeometry.setWidth(tqgeometry.width()-d->undoButton->width()); } - d->currentWidget->resize(geometry.width(), geometry.height()); + d->currentWidget->resize(tqgeometry.width(), tqgeometry.height()); }*/ d->undoButton->hide(); return; } - QPoint p = contentsToViewport(QPoint(0, geometry.y())); - d->undoButton->move(geometry.x() + geometry.width() + TQPoint p = contentsToViewport(TQPoint(0, tqgeometry.y())); + d->undoButton->move(tqgeometry.x() + tqgeometry.width() -((d->currentWidget && d->currentWidget->hasBorders())?1:0)/*editor is moved by 1 to left*/ - d->undoButton->width(), p.y()); // if (d->currentWidget) { // d->currentWidget->move(d->currentWidget->x(), p.y()); -// d->currentWidget->resize(geometry.width()-d->undoButton->width(), geometry.height()); +// d->currentWidget->resize(tqgeometry.width()-d->undoButton->width(), tqgeometry.height()); // } d->undoButton->show(); } void -Editor::slotExpanded(QListViewItem *item) +Editor::slotExpanded(TQListViewItem *item) { if (!item) return; @@ -790,19 +790,19 @@ Editor::slotExpanded(QListViewItem *item) } updateEditorGeometry(); updateGroupLabelsPosition(); - repaintContents(); - repaint(); + tqrepaintContents(); + tqrepaint(); } void -Editor::slotCollapsed(QListViewItem *item) +Editor::slotCollapsed(TQListViewItem *item) { if (!item) return; //unselect child item and hide editor if a group item has been collapsed if (dynamic_cast<EditorGroupItem*>(item)) { - for (QListViewItem *i = selectedItem(); i; i = i->parent()) { - if (i->parent()==item) { + for (TQListViewItem *i = selectedItem(); i; i = i->tqparent()) { + if (i->tqparent()==item) { d->previouslyCollapsedGroupItem = item; d->childFormPreviouslyCollapsedGroupItem = selectedItem(); hideEditor(); @@ -814,8 +814,8 @@ Editor::slotCollapsed(QListViewItem *item) } updateEditorGeometry(); updateGroupLabelsPosition(); - repaintContents(); - repaint(); + tqrepaintContents(); + tqrepaint(); } void @@ -824,9 +824,9 @@ Editor::slotColumnSizeChanged(int section, int oldSize, int newSize) Q_UNUSED(section); Q_UNUSED(oldSize); Q_UNUSED(newSize); - /*for (QListViewItemIterator it(this); it.current(); ++it) { + /*for (TQListViewItemIterator it(this); it.current(); ++it) { if (section == 0 && dynamic_cast<EditorGroupItem*>(it.current())) { - it.current()->repaint(); + it.current()->tqrepaint(); } }*/ /* @@ -842,8 +842,8 @@ Editor::slotColumnSizeChanged(int section, int oldSize, int newSize) d->currentWidget->height()); } }*/ -// repaintContents(); -// repaint(); +// tqrepaintContents(); +// tqrepaint(); updateEditorGeometry(); update(); } @@ -868,11 +868,11 @@ Editor::slotColumnSizeChanged(int section) updateEditorGeometry(); } -QSize -Editor::sizeHint() const +TQSize +Editor::tqsizeHint() const { - return QSize( QFontMetrics(font()).width(columnText(0)+columnText(1)+" "), - KListView::sizeHint().height()); + return TQSize( TQFontMetrics(font()).width(columnText(0)+columnText(1)+" "), + KListView::tqsizeHint().height()); } void @@ -886,7 +886,7 @@ Editor::setFocus() } else { //select an item before focusing - item = static_cast<EditorItem *>(itemAt(QPoint(10,1))); + item = static_cast<EditorItem *>(itemAt(TQPoint(10,1))); if (item) { ensureItemVisible(item); setSelected(item, true); @@ -903,7 +903,7 @@ Editor::setFocus() } void -Editor::resizeEvent(QResizeEvent *ev) +Editor::resizeEvent(TQResizeEvent *ev) { KListView::resizeEvent(ev); if(d->undoButton->isVisible()) @@ -913,25 +913,25 @@ Editor::resizeEvent(QResizeEvent *ev) } bool -Editor::eventFilter( QObject * watched, QEvent * e ) +Editor::eventFilter( TQObject * watched, TQEvent * e ) { - if ((watched==this || watched==viewport()) && e->type()==QEvent::KeyPress) { - if (handleKeyPress(static_cast<QKeyEvent*>(e))) + if ((TQT_BASE_OBJECT(watched)==TQT_BASE_OBJECT(this) || TQT_BASE_OBJECT(watched)==TQT_BASE_OBJECT(viewport())) && e->type()==TQEvent::KeyPress) { + if (handleKeyPress(TQT_TQKEYEVENT(e))) return true; } return KListView::eventFilter(watched, e); } bool -Editor::handleKeyPress(QKeyEvent* ev) +Editor::handleKeyPress(TQKeyEvent* ev) { const int k = ev->key(); - const Qt::ButtonState s = ev->state(); + const TQt::ButtonState s = ev->state(); //selection moving - QListViewItem *item = 0; + TQListViewItem *item = 0; - if ( ((s == NoButton) && (k == Key_Up)) || (k==Key_BackTab) ) { + if ( ((s == Qt::NoButton) && (k == Key_Up)) || (k==Key_BackTab) ) { //find prev visible item = selectedItem() ? selectedItem()->itemAbove() : 0; while (item && (!item->isSelectable() || !item->isVisible())) @@ -939,7 +939,7 @@ Editor::handleKeyPress(QKeyEvent* ev) if (!item) return true; } - else if( (s == NoButton) && ((k == Key_Down) || (k == Key_Tab)) ) { + else if( (s == Qt::NoButton) && ((k == Key_Down) || (k == Key_Tab)) ) { //find next visible item = selectedItem() ? selectedItem()->itemBelow() : 0; while (item && (!item->isSelectable() || !item->isVisible())) @@ -947,20 +947,20 @@ Editor::handleKeyPress(QKeyEvent* ev) if (!item) return true; } - else if( (s==NoButton) && (k==Key_Home) ) { + else if( (s==Qt::NoButton) && (k==Key_Home) ) { if (d->currentWidget && d->currentWidget->hasFocus()) return false; - //find 1st visible + //tqfind 1st visible item = firstChild(); while (item && (!item->isSelectable() || !item->isVisible())) item = item->itemBelow(); } - else if( (s==NoButton) && (k==Key_End) ) { + else if( (s==Qt::NoButton) && (k==Key_End) ) { if (d->currentWidget && d->currentWidget->hasFocus()) return false; //find last visible item = selectedItem(); - QListViewItem *lastVisible = item; + TQListViewItem *lastVisible = item; while (item) { // && (!item->isSelectable() || !item->isVisible())) item = item->itemBelow(); if (item && item->isSelectable() && item->isVisible()) @@ -981,8 +981,8 @@ Editor::handleKeyPress(QKeyEvent* ev) void Editor::updateFont() { - setFont(parentWidget()->font()); - d->baseRowHeight = QFontMetrics(parentWidget()->font()).height() + itemMargin() * 2; + setFont(tqparentWidget()->font()); + d->baseRowHeight = TQFontMetrics(tqparentWidget()->font()).height() + itemMargin() * 2; if (!d->currentItem) d->undoButton->resize(d->baseRowHeight, d->baseRowHeight); else { @@ -993,18 +993,18 @@ Editor::updateFont() } bool -Editor::event( QEvent * e ) +Editor::event( TQEvent * e ) { - if (e->type()==QEvent::ParentFontChange) { + if (e->type()==TQEvent::ParentFontChange) { updateFont(); } return KListView::event(e); } void -Editor::contentsMousePressEvent( QMouseEvent * e ) +Editor::contentsMousePressEvent( TQMouseEvent * e ) { - QListViewItem *item = itemAt(e->pos()); + TQListViewItem *item = itemAt(e->pos()); if (dynamic_cast<EditorGroupItem*>(item)) { setOpen( item, !isOpen(item) ); return; @@ -1020,8 +1020,8 @@ Editor::setSorting( int column, bool ascending ) KListView::setSorting( column, ascending ); updateEditorGeometry(); updateGroupLabelsPosition(); - repaintContents(); - repaint(); + tqrepaintContents(); + tqrepaint(); } #include "editor.moc" |