diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-05 06:00:29 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-05 06:00:29 +0000 |
commit | fecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch) | |
tree | 6b8614802f0d01b353bc9ba78aff2090846c198e /kmymoney2/widgets/kmymoneycompletion.cpp | |
parent | dadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff) | |
download | kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.tar.gz kmymoney-fecb0e67b23e8b83ba7fc881bb57bc48c0852d62.zip |
TQt4 port kmymoney
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kmymoney@1239855 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmymoney2/widgets/kmymoneycompletion.cpp')
-rw-r--r-- | kmymoney2/widgets/kmymoneycompletion.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/kmymoney2/widgets/kmymoneycompletion.cpp b/kmymoney2/widgets/kmymoneycompletion.cpp index f9bc7a3..55e4d75 100644 --- a/kmymoney2/widgets/kmymoneycompletion.cpp +++ b/kmymoney2/widgets/kmymoneycompletion.cpp @@ -23,7 +23,7 @@ // ---------------------------------------------------------------------------- // QT Includes -#include <qapplication.h> +#include <tqapplication.h> // ---------------------------------------------------------------------------- // KDE Includes @@ -40,23 +40,23 @@ const int kMyMoneyCompletion::MAX_ITEMS = 16; -kMyMoneyCompletion::kMyMoneyCompletion(QWidget *parent, const char *name ) : - QVBox(parent, name, WType_Popup) +kMyMoneyCompletion::kMyMoneyCompletion(TQWidget *tqparent, const char *name ) : + TQVBox(tqparent, name, WType_Popup) { m_selector = new KMyMoneySelector(this); m_selector->listView()->setFocusProxy(this); - m_parent = parent; - setFocusProxy((parent) ? parent : (QWidget*) NoFocus); - setFrameStyle(QFrame::PopupPanel | QFrame::Raised); + m_parent = tqparent; + setFocusProxy((tqparent) ? tqparent : (TQWidget*) TQ_NoFocus); + setFrameStyle(TQFrame::PopupPanel | TQFrame::Raised); connectSignals(m_selector, m_selector->listView()); } -void kMyMoneyCompletion::connectSignals(QWidget* widget, KListView* lv) +void kMyMoneyCompletion::connectSignals(TQWidget* widget, KListView* lv) { m_widget = widget; m_lv = lv; - connect(lv, SIGNAL(executed(QListViewItem*,const QPoint&,int)), this, SLOT(slotItemSelected(QListViewItem*,const QPoint&,int))); + connect(lv, TQT_SIGNAL(executed(TQListViewItem*,const TQPoint&,int)), this, TQT_SLOT(slotItemSelected(TQListViewItem*,const TQPoint&,int))); } kMyMoneyCompletion::~kMyMoneyCompletion() @@ -65,7 +65,7 @@ kMyMoneyCompletion::~kMyMoneyCompletion() void kMyMoneyCompletion::adjustSize(void) { - QListViewItemIterator it(m_lv, QListViewItemIterator::Visible); + TQListViewItemIterator it(m_lv, TQListViewItemIterator::Visible); int count = 0; while(it.current()) { ++count; @@ -76,17 +76,17 @@ void kMyMoneyCompletion::adjustSize(void) void kMyMoneyCompletion::adjustSize(const int count) { - int w = m_widget->sizeHint().width(); + int w = m_widget->tqsizeHint().width(); if(m_parent && w < m_parent->width()) w = m_parent->width(); - QFontMetrics fm(font()); + TQFontMetrics fm(font()); if(w < fm.maxWidth()*15) w = fm.maxWidth()*15; int h = 0; - QListViewItemIterator it(m_lv, QListViewItemIterator::Visible); - QListViewItem* item = it.current(); + TQListViewItemIterator it(m_lv, TQListViewItemIterator::Visible); + TQListViewItem* item = it.current(); if(item) h = item->height() * (count > MAX_ITEMS ? MAX_ITEMS : count); @@ -99,11 +99,11 @@ void kMyMoneyCompletion::adjustSize(const int count) // and modified to our local needs // this is probably better, once kde switches to requiring qt3.1 - // QRect screenSize = QApplication::desktop()->availableGeometry(d->m_parent); + // TQRect screenSize = TQApplication::desktop()->availableGeometry(d->m_parent); // for now use this since it's qt3.0.x-safe - QRect screenSize = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(m_parent)); + TQRect screenSize = TQApplication::desktop()->screenGeometry(TQApplication::desktop()->screenNumber(m_parent)); - QPoint orig = m_parent->mapToGlobal( QPoint(0, m_parent->height()) ); + TQPoint orig = m_parent->mapToGlobal( TQPoint(0, m_parent->height()) ); int x = orig.x(); int y = orig.y(); @@ -133,7 +133,7 @@ void kMyMoneyCompletion::show(bool presetSelected) if(m_parent) { m_parent->installEventFilter(this); // make sure to install the filter for the combobox lineedit as well - // We have do this here because QObject::installEventFilter() is not + // We have do this here because TQObject::installEventFilter() is not // declared virtual and we have no chance to override it in KMyMoneyCombo KMyMoneyCombo* c = dynamic_cast<KMyMoneyCombo*>(m_parent); if(c && c->lineEdit()) { @@ -141,7 +141,7 @@ void kMyMoneyCompletion::show(bool presetSelected) } } - QVBox::show(); + TQVBox::show(); } void kMyMoneyCompletion::hide(void) @@ -149,37 +149,37 @@ void kMyMoneyCompletion::hide(void) if(m_parent) { m_parent->removeEventFilter(this); // make sure to uninstall the filter for the combobox lineedit as well - // We have do this here because QObject::installEventFilter() is not + // We have do this here because TQObject::installEventFilter() is not // declared virtual and we have no chance to override it in KMyMoneyCombo KMyMoneyCombo* c = dynamic_cast<KMyMoneyCombo*>(m_parent); if(c && c->lineEdit()) { c->lineEdit()->removeEventFilter(this); } } - QVBox::hide(); + TQVBox::hide(); } -bool kMyMoneyCompletion::eventFilter(QObject* o, QEvent* e) +bool kMyMoneyCompletion::eventFilter(TQObject* o, TQEvent* e) { int type = e->type(); KMyMoneyCombo *c = dynamic_cast<KMyMoneyCombo*>(m_parent); - QListViewItem* item; - if(o == m_parent || (c && o == c->lineEdit())) { + TQListViewItem* item; + if(TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(m_parent) || (c && TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(c->lineEdit()))) { if(isVisible()) { - if(type == QEvent::KeyPress) { - QKeyEvent* ev = static_cast<QKeyEvent*> (e); - QKeyEvent evt(QEvent::KeyPress, - Key_Down, 0, ev->state(), QString::null, + if(type == TQEvent::KeyPress) { + TQKeyEvent* ev = TQT_TQKEYEVENT (e); + TQKeyEvent evt(TQEvent::KeyPress, + Key_Down, 0, ev->state(), TQString(), ev->isAutoRepeat(), ev->count()); - QKeyEvent evbt(QEvent::KeyPress, - Key_Up, 0, ev->state(), QString::null, + TQKeyEvent evbt(TQEvent::KeyPress, + Key_Up, 0, ev->state(), TQString(), ev->isAutoRepeat(), ev->count()); switch(ev->key()) { case Key_Tab: case Key_BackTab: - slotItemSelected(m_lv->currentItem(), QPoint(0,0), 0); + slotItemSelected(m_lv->currentItem(), TQPoint(0,0), 0); break; case Key_Down: @@ -222,7 +222,7 @@ bool kMyMoneyCompletion::eventFilter(QObject* o, QEvent* e) case Key_Enter: case Key_Return: - slotItemSelected(m_lv->currentItem(), QPoint(0,0), 0); + slotItemSelected(m_lv->currentItem(), TQPoint(0,0), 0); ev->accept(); return true; @@ -264,10 +264,10 @@ bool kMyMoneyCompletion::eventFilter(QObject* o, QEvent* e) } } } - return QVBox::eventFilter(o, e); + return TQVBox::eventFilter(o, e); } -void kMyMoneyCompletion::slotMakeCompletion(const QString& txt) +void kMyMoneyCompletion::slotMakeCompletion(const TQString& txt) { int cnt = selector()->slotMakeCompletion(txt.stripWhiteSpace()); @@ -282,11 +282,11 @@ void kMyMoneyCompletion::slotMakeCompletion(const QString& txt) } } -void kMyMoneyCompletion::slotItemSelected(QListViewItem *item, const QPoint&, int) +void kMyMoneyCompletion::slotItemSelected(TQListViewItem *item, const TQPoint&, int) { KMyMoneyListViewItem* it_v = static_cast<KMyMoneyListViewItem*>(item); if(it_v && it_v->isSelectable()) { - QString id = it_v->id(); + TQString id = it_v->id(); // hide the widget, so we can debug the slots that are connect // to the signal we emit very soon hide(); @@ -295,7 +295,7 @@ void kMyMoneyCompletion::slotItemSelected(QListViewItem *item, const QPoint&, in } } -void kMyMoneyCompletion::setSelected(const QString& id) +void kMyMoneyCompletion::setSelected(const TQString& id) { m_id = id; m_selector->setSelected(id, true); |