diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kexi/plugins/forms/widgets/kexidbform.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-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/plugins/forms/widgets/kexidbform.cpp')
-rw-r--r-- | kexi/plugins/forms/widgets/kexidbform.cpp | 280 |
1 files changed, 140 insertions, 140 deletions
diff --git a/kexi/plugins/forms/widgets/kexidbform.cpp b/kexi/plugins/forms/widgets/kexidbform.cpp index cff12c7c..12210430 100644 --- a/kexi/plugins/forms/widgets/kexidbform.cpp +++ b/kexi/plugins/forms/widgets/kexidbform.cpp @@ -19,11 +19,11 @@ * Boston, MA 02110-1301, USA. */ -#include <qobjectlist.h> -#include <qpainter.h> -#include <qcursor.h> -#include <qapplication.h> -#include <qfocusdata.h> +#include <tqobjectlist.h> +#include <tqpainter.h> +#include <tqcursor.h> +#include <tqapplication.h> +#include <tqfocusdata.h> #include <kdebug.h> @@ -55,7 +55,7 @@ class KexiDBForm::Private } //! \return index of data-aware widget \a widget - int indexOfDataAwareWidget(QWidget *widget) const + int indexOfDataAwareWidget(TQWidget *widget) const { if (!dynamic_cast<KexiDataItemInterface*>(widget)) return -1; @@ -65,8 +65,8 @@ class KexiDBForm::Private //! \return index of data item \a item, or -1 if not found int indexOfDataItem( KexiDataItemInterface* item ) const { - QMapConstIterator<KexiDataItemInterface*, uint> indicesForDataAwareWidgetsIt( - indicesForDataAwareWidgets.find(item)); + TQMapConstIterator<KexiDataItemInterface*, uint> indicesForDataAwareWidgetsIt( + indicesForDataAwareWidgets.tqfind(item)); if (indicesForDataAwareWidgetsIt == indicesForDataAwareWidgets.constEnd()) return -1; kexipluginsdbg << "KexiDBForm: column # for item: " @@ -75,7 +75,7 @@ class KexiDBForm::Private } //! Sets orderedFocusWidgetsIterator member to a position pointing to \a widget - void setOrderedFocusWidgetsIteratorTo( QWidget *widget ) + void setOrderedFocusWidgetsIteratorTo( TQWidget *widget ) { if (orderedFocusWidgetsIterator.current() == widget) return; @@ -86,23 +86,23 @@ class KexiDBForm::Private KexiDataAwareObjectInterface* dataAwareObject; //! ordered list of focusable widgets (can be both data-widgets or buttons, etc.) - QPtrList<QWidget> orderedFocusWidgets; + TQPtrList<TQWidget> orderedFocusWidgets; //! ordered list of data-aware widgets - QPtrList<QWidget> orderedDataAwareWidgets; - QMap<KexiDataItemInterface*, uint> indicesForDataAwareWidgets; //!< a subset of orderedFocusWidgets mapped to indices - QPtrListIterator<QWidget> orderedFocusWidgetsIterator; - QPixmap buffer; //!< stores grabbed entire form's area for redraw - QRect prev_rect; //!< previously selected rectangle -// QGuardedPtr<QWidget> widgetFocusedBeforePopup; + TQPtrList<TQWidget> orderedDataAwareWidgets; + TQMap<KexiDataItemInterface*, uint> indicesForDataAwareWidgets; //!< a subset of orderedFocusWidgets mapped to indices + TQPtrListIterator<TQWidget> orderedFocusWidgetsIterator; + TQPixmap buffer; //!< stores grabbed entire form's area for redraw + TQRect prev_rect; //!< previously selected rectangle +// TQGuardedPtr<TQWidget> widgetFocusedBeforePopup; bool autoTabStops : 1; bool popupFocused : 1; //!< used in KexiDBForm::eventFilter() }; //======================== -KexiDBForm::KexiDBForm(QWidget *parent, KexiDataAwareObjectInterface* dataAwareObject, +KexiDBForm::KexiDBForm(TQWidget *tqparent, KexiDataAwareObjectInterface* dataAwareObject, const char *name/*, KexiDB::Connection *conn*/) - : KexiDBFormBase(parent, name) + : KexiDBFormBase(tqparent, name) , KexiFormDataItemInterface() , d(new Private()) { @@ -113,7 +113,7 @@ KexiDBForm::KexiDBForm(QWidget *parent, KexiDataAwareObjectInterface* dataAwareO m_hasFocusableWidget = false; kexipluginsdbg << "KexiDBForm::KexiDBForm(): " << endl; - setCursor(QCursor(Qt::ArrowCursor)); //to avoid keeping Size cursor when moving from form's boundaries + setCursor(TQCursor(TQt::ArrowCursor)); //to avoid keeping Size cursor when moving from form's boundaries setAcceptDrops( true ); } @@ -125,48 +125,48 @@ KexiDBForm::~KexiDBForm() KexiDataAwareObjectInterface* KexiDBForm::dataAwareObject() const { return d->dataAwareObject; } -//repaint all children widgets -static void repaintAll(QWidget *w) +//tqrepaint all tqchildren widgets +static void tqrepaintAll(TQWidget *w) { - QObjectList *list = w->queryList("QWidget"); - QObjectListIt it(*list); - for (QObject *obj; (obj=it.current()); ++it ) { - static_cast<QWidget*>(obj)->repaint(); + TQObjectList *list = w->queryList(TQWIDGET_OBJECT_NAME_STRING); + TQObjectListIt it(*list); + for (TQObject *obj; (obj=it.current()); ++it ) { + TQT_TQWIDGET(obj)->tqrepaint(); } delete list; } void -KexiDBForm::drawRect(const QRect& r, int type) +KexiDBForm::drawRect(const TQRect& r, int type) { - QValueList<QRect> l; + TQValueList<TQRect> l; l.append(r); drawRects(l, type); } void -KexiDBForm::drawRects(const QValueList<QRect> &list, int type) +KexiDBForm::drawRects(const TQValueList<TQRect> &list, int type) { - QPainter p; - p.begin(this, true); + TQPainter p; + p.tqbegin(TQT_TQPAINTDEVICE(this), true); bool unclipped = testWFlags( WPaintUnclipped ); setWFlags( WPaintUnclipped ); if (d->prev_rect.isValid()) { //redraw prev. selection's rectangle - p.drawPixmap( QPoint(d->prev_rect.x()-2, d->prev_rect.y()-2), d->buffer, - QRect(d->prev_rect.x()-2, d->prev_rect.y()-2, d->prev_rect.width()+4, d->prev_rect.height()+4)); + p.drawPixmap( TQPoint(d->prev_rect.x()-2, d->prev_rect.y()-2), d->buffer, + TQRect(d->prev_rect.x()-2, d->prev_rect.y()-2, d->prev_rect.width()+4, d->prev_rect.height()+4)); } - p.setBrush(QBrush::NoBrush); + p.setBrush(TQBrush::NoBrush); if(type == 1) // selection rect - p.setPen(QPen(white, 1, Qt::DotLine)); + p.setPen(TQPen(white, 1, TQt::DotLine)); else if(type == 2) // insert rect - p.setPen(QPen(white, 2)); + p.setPen(TQPen(white, 2)); p.setRasterOp(XorROP); - d->prev_rect = QRect(); - QValueList<QRect>::ConstIterator endIt = list.constEnd(); - for(QValueList<QRect>::ConstIterator it = list.constBegin(); it != endIt; ++it) { + d->prev_rect = TQRect(); + TQValueList<TQRect>::ConstIterator endIt = list.constEnd(); + for(TQValueList<TQRect>::ConstIterator it = list.constBegin(); it != endIt; ++it) { p.drawRect(*it); if (d->prev_rect.isValid()) d->prev_rect = d->prev_rect.unite(*it); @@ -182,59 +182,59 @@ KexiDBForm::drawRects(const QValueList<QRect> &list, int type) void KexiDBForm::initBuffer() { - repaintAll(this); + tqrepaintAll(this); d->buffer.resize( width(), height() ); - d->buffer = QPixmap::grabWindow( winId() ); - d->prev_rect = QRect(); + d->buffer = TQPixmap::grabWindow( winId() ); + d->prev_rect = TQRect(); } void KexiDBForm::clearForm() { - QPainter p; - p.begin(this, true); + TQPainter p; + p.tqbegin(TQT_TQPAINTDEVICE(this), true); bool unclipped = testWFlags( WPaintUnclipped ); setWFlags( WPaintUnclipped ); //redraw entire form surface - p.drawPixmap( QPoint(0,0), d->buffer, QRect(0,0,d->buffer.width(), d->buffer.height()) ); + p.drawPixmap( TQPoint(0,0), d->buffer, TQRect(0,0,d->buffer.width(), d->buffer.height()) ); if (!unclipped) clearWFlags( WPaintUnclipped ); p.end(); - repaintAll(this); + tqrepaintAll(this); } void -KexiDBForm::highlightWidgets(QWidget *from, QWidget *to)//, const QPoint &point) +KexiDBForm::highlightWidgets(TQWidget *from, TQWidget *to)//, const TQPoint &point) { - QPoint fromPoint, toPoint; - if(from && from->parentWidget() && (from != this)) - fromPoint = from->parentWidget()->mapTo(this, from->pos()); - if(to && to->parentWidget() && (to != this)) - toPoint = to->parentWidget()->mapTo(this, to->pos()); - - QPainter p; - p.begin(this, true); + TQPoint fromPoint, toPoint; + if(from && from->tqparentWidget() && (from != this)) + fromPoint = from->tqparentWidget()->mapTo(this, from->pos()); + if(to && to->tqparentWidget() && (to != this)) + toPoint = to->tqparentWidget()->mapTo(this, to->pos()); + + TQPainter p; + p.tqbegin(TQT_TQPAINTDEVICE(this), true); bool unclipped = testWFlags( WPaintUnclipped ); setWFlags( WPaintUnclipped ); if (d->prev_rect.isValid()) { //redraw prev. selection's rectangle - p.drawPixmap( QPoint(d->prev_rect.x(), d->prev_rect.y()), d->buffer, - QRect(d->prev_rect.x(), d->prev_rect.y(), d->prev_rect.width(), d->prev_rect.height())); + p.drawPixmap( TQPoint(d->prev_rect.x(), d->prev_rect.y()), d->buffer, + TQRect(d->prev_rect.x(), d->prev_rect.y(), d->prev_rect.width(), d->prev_rect.height())); } - p.setPen( QPen(Qt::red, 2) ); + p.setPen( TQPen(TQt::red, 2) ); if(to) { - QPixmap pix1 = QPixmap::grabWidget(from); - QPixmap pix2 = QPixmap::grabWidget(to); + TQPixmap pix1 = TQPixmap::grabWidget(from); + TQPixmap pix2 = TQPixmap::grabWidget(to); if((from != this) && (to != this)) - p.drawLine( from->parentWidget()->mapTo(this, from->geometry().center()), to->parentWidget()->mapTo(this, to->geometry().center()) ); + p.drawLine( from->tqparentWidget()->mapTo(this, from->tqgeometry().center()), to->tqparentWidget()->mapTo(this, to->tqgeometry().center()) ); p.drawPixmap(fromPoint.x(), fromPoint.y(), pix1); p.drawPixmap(toPoint.x(), toPoint.y(), pix2); @@ -251,7 +251,7 @@ KexiDBForm::highlightWidgets(QWidget *from, QWidget *to)//, const QPoint &point) p.drawRoundRect(fromPoint.x(), fromPoint.y(), from->width(), from->height(), 5, 5); if((to == this) || (from == this)) - d->prev_rect = QRect(0, 0, d->buffer.width(), d->buffer.height()); + d->prev_rect = TQRect(0, 0, d->buffer.width(), d->buffer.height()); else if(to) { d->prev_rect.setX( (fromPoint.x() < toPoint.x()) ? (fromPoint.x() - 5) : (toPoint.x() - 5) ); @@ -260,21 +260,21 @@ KexiDBForm::highlightWidgets(QWidget *from, QWidget *to)//, const QPoint &point) d->prev_rect.setBottom( (fromPoint.y() < toPoint.y()) ? (toPoint.y() + to->height() + 10) : (fromPoint.y() + from->height() + 10) ) ; } else - d->prev_rect = QRect(fromPoint.x()- 5, fromPoint.y() -5, from->width() + 10, from->height() + 10); + d->prev_rect = TQRect(fromPoint.x()- 5, fromPoint.y() -5, from->width() + 10, from->height() + 10); if (!unclipped) clearWFlags( WPaintUnclipped ); p.end(); } -QSize -KexiDBForm::sizeHint() const +TQSize +KexiDBForm::tqsizeHint() const { //todo: find better size (user configured?) - return QSize(400,300); + return TQSize(400,300); } -void KexiDBForm::setInvalidState( const QString& displayText ) +void KexiDBForm::setInvalidState( const TQString& displayText ) { Q_UNUSED( displayText ); @@ -291,40 +291,40 @@ void KexiDBForm::setAutoTabStops(bool set) d->autoTabStops = set; } -QPtrList<QWidget>* KexiDBForm::orderedFocusWidgets() const +TQPtrList<TQWidget>* KexiDBForm::orderedFocusWidgets() const { return &d->orderedFocusWidgets; } -QPtrList<QWidget>* KexiDBForm::orderedDataAwareWidgets() const +TQPtrList<TQWidget>* KexiDBForm::orderedDataAwareWidgets() const { return &d->orderedDataAwareWidgets; } void KexiDBForm::updateTabStopsOrder(KFormDesigner::Form* form) { - QWidget *fromWidget = 0; - //QWidget *topLevelWidget = form->widget()->topLevelWidget(); + TQWidget *fromWidget = 0; + //TQWidget *tqtopLevelWidget = form->widget()->tqtopLevelWidget(); //js form->updateTabStopsOrder(); //certain widgets can have now updated focusPolicy properties, fix this uint numberOfDataAwareWidgets = 0; // if (d->orderedFocusWidgets.isEmpty()) { //generate a new list for (KFormDesigner::ObjectTreeListIterator it(form->tabStopsIterator()); it.current(); ++it) { - if (it.current()->widget()->focusPolicy() & QWidget::TabFocus) { + if (it.current()->widget()->focusPolicy() & TQ_TabFocus) { //this widget has tab focus: it.current()->widget()->installEventFilter(this); - //also filter events for data-aware children of this widget (i.e. KexiDBAutoField's editors) - QObjectList *children = it.current()->widget()->queryList("QWidget"); - for (QObjectListIt childrenIt(*children); childrenIt.current(); ++childrenIt) { - // if (dynamic_cast<KexiFormDataItemInterface*>(childrenIt.current())) { + //also filter events for data-aware tqchildren of this widget (i.e. KexiDBAutoField's editors) + TQObjectList *tqchildren = it.current()->widget()->queryList(TQWIDGET_OBJECT_NAME_STRING); + for (TQObjectListIt tqchildrenIt(*tqchildren); tqchildrenIt.current(); ++tqchildrenIt) { + // if (dynamic_cast<KexiFormDataItemInterface*>(tqchildrenIt.current())) { kexipluginsdbg << "KexiDBForm::updateTabStopsOrder(): also adding '" - << childrenIt.current()->className() << " " << childrenIt.current()->name() + << tqchildrenIt.current()->className() << " " << tqchildrenIt.current()->name() << "' child to filtered widgets" << endl; - //it.current()->widget()->installEventFilter(static_cast<QWidget*>(childrenIt.current())); - childrenIt.current()->installEventFilter(this); + //it.current()->widget()->installEventFilter(TQT_TQWIDGET(tqchildrenIt.current())); + tqchildrenIt.current()->installEventFilter(this); // } } - delete children; + delete tqchildren; if (fromWidget) { kexipluginsdbg << "KexiDBForm::updateTabStopsOrder() tab order: " << fromWidget->name() << " -> " << it.current()->widget()->name() << endl; @@ -342,7 +342,7 @@ void KexiDBForm::updateTabStopsOrder(KFormDesigner::Form* form) // /*! @todo d->indicesForDataAwareWidgets SHOULDNT BE UPDATED HERE BECAUSE // THERE CAN BE ALSO NON-TABSTOP DATA WIDGETS! // */ - d->indicesForDataAwareWidgets.replace( + d->indicesForDataAwareWidgets.tqreplace( dataItem, numberOfDataAwareWidgets ); numberOfDataAwareWidgets++; @@ -353,7 +353,7 @@ void KexiDBForm::updateTabStopsOrder(KFormDesigner::Form* form) // } /* else { //restore ordering - for (QPtrListIterator<QWidget> it(d->orderedFocusWidgets); it.current(); ++it) { + for (TQPtrListIterator<TQWidget> it(d->orderedFocusWidgets); it.current(); ++it) { if (fromWidget) { kdDebug() << "KexiDBForm::updateTabStopsOrder() tab order: " << fromWidget->name() << " -> " << it.current()->name() << endl; @@ -361,14 +361,14 @@ void KexiDBForm::updateTabStopsOrder(KFormDesigner::Form* form) } fromWidget = it.current(); } -// SET_FOCUS_USING_REASON(focusWidget(), QFocusEvent::Tab); +// SET_FOCUS_USING_REASON(tqfocusWidget(), TQFocusEvent::Tab); }*/ } void KexiDBForm::updateTabStopsOrder() { - for (QPtrListIterator<QWidget> it( d->orderedFocusWidgets ); it.current();) { - if (! (it.current()->focusPolicy() & QWidget::TabFocus)) + for (TQPtrListIterator<TQWidget> it( d->orderedFocusWidgets ); it.current();) { + if (! (it.current()->focusPolicy() & TQ_TabFocus)) d->orderedFocusWidgets.remove( it.current() ); else ++it; @@ -377,7 +377,7 @@ void KexiDBForm::updateTabStopsOrder() void KexiDBForm::updateReadOnlyFlags() { - for (QPtrListIterator<QWidget> it(d->orderedDataAwareWidgets); it.current(); ++it) { + for (TQPtrListIterator<TQWidget> it(d->orderedDataAwareWidgets); it.current(); ++it) { KexiFormDataItemInterface* dataItem = dynamic_cast<KexiFormDataItemInterface*>( it.current() ); if (dataItem && !dataItem->dataSource().isEmpty()) { if (dataAwareObject()->isReadOnly()) { @@ -387,27 +387,27 @@ void KexiDBForm::updateReadOnlyFlags() } } -bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) +bool KexiDBForm::eventFilter( TQObject * watched, TQEvent * e ) { //kexipluginsdbg << e->type() << endl; - if (e->type()==QEvent::Resize && watched == this) + if (e->type()==TQEvent::Resize && TQT_BASE_OBJECT(watched) == TQT_BASE_OBJECT(this)) kexipluginsdbg << "RESIZE" << endl; - if (e->type()==QEvent::KeyPress) { + if (e->type()==TQEvent::KeyPress) { if (preview()) { - QKeyEvent *ke = static_cast<QKeyEvent*>(e); + TQKeyEvent *ke = TQT_TQKEYEVENT(e); const int key = ke->key(); - bool tab = ke->state() == Qt::NoButton && key == Qt::Key_Tab; - bool backtab = ((ke->state() == Qt::NoButton || ke->state() == Qt::ShiftButton) && key == Qt::Key_Backtab) - || (ke->state() == Qt::ShiftButton && key == Qt::Key_Tab); - QObject *o = watched; //focusWidget(); - QWidget* realWidget = dynamic_cast<QWidget*>(o); //will beused below (for tab/backtab handling) + bool tab = ke->state() == Qt::NoButton && key == TQt::Key_Tab; + bool backtab = ((ke->state() == Qt::NoButton || ke->state() == TQt::ShiftButton) && key == TQt::Key_Backtab) + || (ke->state() == TQt::ShiftButton && key == TQt::Key_Tab); + TQObject *o = watched; //tqfocusWidget(); + TQWidget* realWidget = dynamic_cast<TQWidget*>(o); //will beused below (for tab/backtab handling) if (!tab && !backtab) { //for buttons, left/up and right/down keys act like tab/backtab (see qbutton.cpp) - if (realWidget->inherits("QButton")) { - if (ke->state() == Qt::NoButton && (key == Qt::Key_Right || key == Qt::Key_Down)) + if (realWidget->inherits(TQBUTTON_OBJECT_NAME_STRING)) { + if (ke->state() == Qt::NoButton && (key == TQt::Key_Right || key == TQt::Key_Down)) tab = true; - else if (ke->state() == Qt::NoButton && (key == Qt::Key_Left || key == Qt::Key_Up)) + else if (ke->state() == Qt::NoButton && (key == TQt::Key_Left || key == TQt::Key_Up)) backtab = true; } } @@ -415,21 +415,21 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) if (!tab && !backtab) { // allow the editor widget to grab the key press event while (true) { - if (!o || o == dynamic_cast<QObject*>(d->dataAwareObject)) + if (!o || o == dynamic_cast<TQObject*>(d->dataAwareObject)) break; if (dynamic_cast<KexiFormDataItemInterface*>(o)) { - realWidget = dynamic_cast<QWidget*>(o); //will be used below + realWidget = dynamic_cast<TQWidget*>(o); //will be used below if (realWidget == this) //we have encountered 'this' form surface, give up return false; KexiFormDataItemInterface* dataItemIface = dynamic_cast<KexiFormDataItemInterface*>(o); while (dataItemIface) { if (dataItemIface->keyPressed(ke)) return false; - dataItemIface = dynamic_cast<KexiFormDataItemInterface*>(dataItemIface->parentInterface()); //try in parent, e.g. in combobox + dataItemIface = dynamic_cast<KexiFormDataItemInterface*>(dataItemIface->tqparentInterface()); //try in tqparent, e.g. in combobox } break; } - o = o->parent(); + o = o->tqparent(); } // try to handle global shortcuts at the KexiDataAwareObjectInterface // level (e.g. for "next record" action) @@ -437,15 +437,15 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) int curCol = d->dataAwareObject->currentColumn(); bool moveToFirstField; //if true, we'll move focus to the first field (in tab order) bool moveToLastField; //if true, we'll move focus to the first field (in tab order) - if (! (ke->state() == Qt::NoButton && (key == Qt::Key_Home - || key == Qt::Key_End || key == Qt::Key_Down || key == Qt::Key_Up)) + if (! (ke->state() == Qt::NoButton && (key == TQt::Key_Home + || key == TQt::Key_End || key == TQt::Key_Down || key == TQt::Key_Up)) /* ^^ home/end/down/up are already handled by widgets */ && d->dataAwareObject->handleKeyPress( ke, curRow, curCol, false/*!fullRowSelection*/, &moveToFirstField, &moveToLastField)) { if (ke->isAccepted()) return true; - QWidget* widgetToFocus; + TQWidget* widgetToFocus; if (moveToFirstField) { widgetToFocus = d->orderedFocusWidgets.first(); //? curCol = d->indexOfDataAwareWidget( widgetToFocus ); @@ -467,14 +467,14 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) ke->accept(); return true; } - if (key == Qt::Key_Delete && ke->state()==Qt::ControlButton) { + if (key == TQt::Key_Delete && ke->state()==TQt::ControlButton) { //! @todo remove hardcoded shortcuts: can be reconfigured... d->dataAwareObject->deleteCurrentRow(); return true; } } // handle Esc key - if (ke->state() == Qt::NoButton && key == Qt::Key_Escape) { + if (ke->state() == Qt::NoButton && key == TQt::Key_Escape) { //cancel field editing/row editing if possible if (d->dataAwareObject->cancelEditor()) return true; @@ -482,29 +482,29 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) return true; return false; // canceling not needed - pass the event to the active widget } - // jstaniek: Fix for Qt bug (handling e.g. Alt+2, Ctrl+2 keys on every platform) + // jstaniek: Fix for TQt bug (handling e.g. Alt+2, Ctrl+2 keys on every platform) // It's important because we're using alt+2 short cut by default // Damn! I've reported this to Trolltech in November 2004 - still not fixed. - if (ke->isAccepted() && (ke->state() & Qt::AltButton) && ke->text()>="0" && ke->text()<="9") + if (ke->isAccepted() && (ke->state() & TQt::AltButton) && ke->text()>="0" && ke->text()<="9") return true; if (tab || backtab) { //the watched widget can be a subwidget of a real widget, e.g. a drop down button of image box: find it while (!KexiFormPart::library()->widgetInfoForClassName(realWidget->className())) - realWidget = realWidget->parentWidget(); + realWidget = realWidget->tqparentWidget(); if (!realWidget) return true; //ignore //the watched widget can be a subwidget of a real widget, e.g. autofield: find it - //QWidget* realWidget = static_cast<QWidget*>(watched); - while (dynamic_cast<KexiDataItemInterface*>(realWidget) && dynamic_cast<KexiDataItemInterface*>(realWidget)->parentInterface()) - realWidget = dynamic_cast<QWidget*>( dynamic_cast<KexiDataItemInterface*>(realWidget)->parentInterface() ); + //TQWidget* realWidget = TQT_TQWIDGET(watched); + while (dynamic_cast<KexiDataItemInterface*>(realWidget) && dynamic_cast<KexiDataItemInterface*>(realWidget)->tqparentInterface()) + realWidget = dynamic_cast<TQWidget*>( dynamic_cast<KexiDataItemInterface*>(realWidget)->tqparentInterface() ); d->setOrderedFocusWidgetsIteratorTo( realWidget ); kexipluginsdbg << realWidget->name() << endl; // find next/prev widget to focus - QWidget *widgetToUnfocus = realWidget; - QWidget *widgetToFocus = 0; + TQWidget *widgetToUnfocus = realWidget; + TQWidget *widgetToFocus = 0; bool wasAtFirstWidget = false; //used to protect against infinite loop while (true) { if (tab) { @@ -533,11 +533,11 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) widgetToFocus = d->orderedFocusWidgetsIterator.current(); - QObject *pageFor_widgetToFocus = 0; + TQObject *pageFor_widgetToFocus = 0; KFormDesigner::TabWidget *tabWidgetFor_widgetToFocus = KFormDesigner::findParent<KFormDesigner::TabWidget>( widgetToFocus, "KFormDesigner::TabWidget", pageFor_widgetToFocus); - if (tabWidgetFor_widgetToFocus && tabWidgetFor_widgetToFocus->currentPage()!=pageFor_widgetToFocus) { + if (tabWidgetFor_widgetToFocus && TQT_BASE_OBJECT(tabWidgetFor_widgetToFocus->currentPage())!=TQT_BASE_OBJECT(pageFor_widgetToFocus)) { realWidget = widgetToFocus; continue; //the new widget to focus is placed on invisible tab page: move to next widget } @@ -545,21 +545,21 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) }//while //set focus, but don't use just setFocus() because certain widgets - //behaves differently (e.g. QLineEdit calls selectAll()) when - //focus event's reason is QFocusEvent::Tab + //behaves differently (e.g. TQLineEdit calls selectAll()) when + //focus event's reason is TQFocusEvent::Tab if (widgetToFocus->focusProxy()) - widgetToFocus = widgetToFocus->focusProxy(); + widgetToFocus = TQT_TQWIDGET(widgetToFocus->focusProxy()); if (widgetToFocus && d->dataAwareObject->acceptEditor()) { if (tab) { //try to accept this will validate the current input (if any) - KexiUtils::unsetFocusWithReason(widgetToUnfocus, QFocusEvent::Tab); - KexiUtils::setFocusWithReason(widgetToFocus, QFocusEvent::Tab); + KexiUtils::unsetFocusWithReason(widgetToUnfocus, TQFocusEvent::Tab); + KexiUtils::setFocusWithReason(widgetToFocus, TQFocusEvent::Tab); kexipluginsdbg << "focusing " << widgetToFocus->name() << endl; } else {//backtab - KexiUtils::unsetFocusWithReason(widgetToUnfocus, QFocusEvent::Backtab); + KexiUtils::unsetFocusWithReason(widgetToUnfocus, TQFocusEvent::Backtab); //set focus, see above note - KexiUtils::setFocusWithReason(d->orderedFocusWidgetsIterator.current(), QFocusEvent::Backtab); + KexiUtils::setFocusWithReason(d->orderedFocusWidgetsIterator.current(), TQFocusEvent::Backtab); kexipluginsdbg << "focusing " << d->orderedFocusWidgetsIterator.current()->name() << endl; } } @@ -567,9 +567,9 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) } } } - else if (e->type()==QEvent::FocusIn) { + else if (e->type()==TQEvent::FocusIn) { bool focusDataWidget = preview(); - if (static_cast<QFocusEvent*>(e)->reason()==QFocusEvent::Popup) { + if (TQT_TQFOCUSEVENT(e)->reason()==TQFocusEvent::Popup) { kdDebug() << "->>> focus IN, popup" <<endl; focusDataWidget = !d->popupFocused; d->popupFocused = false; @@ -582,10 +582,10 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) if (focusDataWidget) { kexipluginsdbg << "KexiDBForm: FocusIn: " << watched->className() << " " << watched->name() << endl; if (d->dataAwareObject) { - QWidget *dataItem = dynamic_cast<QWidget*>(watched); + TQWidget *dataItem = dynamic_cast<TQWidget*>(watched); while (dataItem) { while (dataItem && !dynamic_cast<KexiDataItemInterface*>(dataItem)) - dataItem = dataItem->parentWidget(); + dataItem = dataItem->tqparentWidget(); if (!dataItem) break; kexipluginsdbg << "KexiDBForm: FocusIn: FOUND " << dataItem->className() << " " << dataItem->name() << endl; @@ -600,23 +600,23 @@ bool KexiDBForm::eventFilter( QObject * watched, QEvent * e ) break; } else - dataItem = dataItem->parentWidget(); + dataItem = dataItem->tqparentWidget(); dataItem->update(); } } } } - else if (e->type()==QEvent::FocusOut) { - if (static_cast<QFocusEvent*>(e)->reason()==QFocusEvent::Popup) { - //d->widgetFocusedBeforePopup = (QWidget*)watched; + else if (e->type()==TQEvent::FocusOut) { + if (TQT_TQFOCUSEVENT(e)->reason()==TQFocusEvent::Popup) { + //d->widgetFocusedBeforePopup = (TQWidget*)watched; d->popupFocused = true; } else d->popupFocused = false; // d->widgetFocusedBeforePopup = 0; -// kdDebug() << "e->type()==QEvent::FocusOut " << watched->className() << " " <<watched->name() << endl; -// UNSET_FOCUS_USING_REASON(watched, static_cast<QFocusEvent*>(e)->reason()); +// kdDebug() << "e->type()==TQEvent::FocusOut " << watched->className() << " " <<watched->name() << endl; +// UNSET_FOCUS_USING_REASON(watched, TQT_TQFOCUSEVENT(e)->reason()); } return KexiDBFormBase::eventFilter(watched, e); } @@ -645,7 +645,7 @@ void KexiDBForm::setReadOnly( bool readOnly ) d->dataAwareObject->setReadOnly( readOnly ); //??? } -QWidget* KexiDBForm::widget() +TQWidget* KexiDBForm::widget() { return this; } @@ -670,19 +670,19 @@ bool KexiDBForm::preview() const { ? dynamic_cast<KexiScrollView*>(d->dataAwareObject)->preview() : false; } -void KexiDBForm::dragMoveEvent( QDragMoveEvent *e ) +void KexiDBForm::dragMoveEvent( TQDragMoveEvent *e ) { KexiDBFormBase::dragMoveEvent( e ); emit handleDragMoveEvent(e); } -void KexiDBForm::dropEvent( QDropEvent *e ) +void KexiDBForm::dropEvent( TQDropEvent *e ) { KexiDBFormBase::dropEvent( e ); emit handleDropEvent(e); } -void KexiDBForm::setCursor( const QCursor & cursor ) +void KexiDBForm::setCursor( const TQCursor & cursor ) { //js: empty, to avoid fscking problems with random cursors! //! @todo? @@ -691,11 +691,11 @@ void KexiDBForm::setCursor( const QCursor & cursor ) KexiDBFormBase::setCursor(cursor); } -//! @todo: Qt4? XORed resize rectangles instead of black widgets +//! @todo: TQt4? XORed resize rectangles instead of black widgets /* -void KexiDBForm::paintEvent( QPaintEvent *e ) +void KexiDBForm::paintEvent( TQPaintEvent *e ) { - QPainter p; + TQPainter p; p.begin(this, true); bool unclipped = testWFlags( WPaintUnclipped ); setWFlags( WPaintUnclipped ); |