From fecb0e67b23e8b83ba7fc881bb57bc48c0852d62 Mon Sep 17 00:00:00 2001 From: tpearson Date: Tue, 5 Jul 2011 06:00:29 +0000 Subject: 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 --- kmymoney2/widgets/transactionform.cpp | 170 +++++++++++++++++----------------- 1 file changed, 85 insertions(+), 85 deletions(-) (limited to 'kmymoney2/widgets/transactionform.cpp') diff --git a/kmymoney2/widgets/transactionform.cpp b/kmymoney2/widgets/transactionform.cpp index 7097b6d..8686371 100644 --- a/kmymoney2/widgets/transactionform.cpp +++ b/kmymoney2/widgets/transactionform.cpp @@ -18,13 +18,13 @@ // ---------------------------------------------------------------------------- // QT Includes -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // ---------------------------------------------------------------------------- // KDE Includes @@ -47,11 +47,11 @@ using namespace KMyMoneyTransactionForm; -TabBar::TabBar(QWidget* parent, const char* name) : - QTabBar(parent, name), +TabBar::TabBar(TQWidget* tqparent, const char* name) : + TQTabBar(tqparent, name), m_signalType(SignalNormal) { - connect(this, SIGNAL(selected(int)), this, SLOT(slotTabSelected(int))); + connect(this, TQT_SIGNAL(selected(int)), this, TQT_SLOT(slotTabSelected(int))); } TabBar::SignalEmissionE TabBar::setSignalEmission(TabBar::SignalEmissionE type) @@ -63,8 +63,8 @@ TabBar::SignalEmissionE TabBar::setSignalEmission(TabBar::SignalEmissionE type) int TabBar::currentTab(void) const { - QMap::const_iterator it; - it = m_idMap.find(QTabBar::currentTab()); + TQMap::const_iterator it; + it = m_idMap.tqfind(TQTabBar::currentTab()); if(it != m_idMap.end()) return *it; return -1; @@ -77,30 +77,30 @@ void TabBar::setCurrentTab(int id) setCurrentTab(tab(id)); } -QTab* TabBar::tab(int id) const +TQTab* TabBar::tab(int id) const { - /* if a QAccel calls setCurrentTab, id will be as set by qt. + /* if a TQAccel calls setCurrentTab, id will be as set by qt. * however if we call it programmatically, id will - * be our own id. We do tell QTab about our id but + * be our own id. We do tell TQTab about our id but * in qt3.3 I (woro) am not able to make sure that - * QAccel also gets it. See registeritem.h: We defined + * TQAccel also gets it. See registeritem.h: We defined * new values for our own ids which should lie way * outside of the range that qt uses */ - QTab *result=QTabBar::tab(id); - QMap::const_iterator it; + TQTab *result=TQTabBar::tab(id); + TQMap::const_iterator it; for(it = m_idMap.begin(); it != m_idMap.end(); ++it) if(*it == id) - result=QTabBar::tab(it.key()); + result=TQTabBar::tab(it.key()); return result; } -void TabBar::setCurrentTab(QTab* tab) +void TabBar::setCurrentTab(TQTab* tab) { if(m_signalType != SignalNormal) blockSignals(true); - QTabBar::setCurrentTab(tab); + TQTabBar::setCurrentTab(tab); if(m_signalType != SignalNormal) blockSignals(false); @@ -109,13 +109,13 @@ void TabBar::setCurrentTab(QTab* tab) emit selected(tab->identifier()); } -void TabBar::addTab(QTab* tab, int id) +void TabBar::addTab(TQTab* tab, int id) { - QTabBar::addTab(tab); + TQTabBar::addTab(tab); setIdentifier(tab, id); } -void TabBar::setIdentifier(QTab* tab, int newId) +void TabBar::setIdentifier(TQTab* tab, int newId) { m_idMap[tab->identifier()] = newId; } @@ -127,8 +127,8 @@ void TransactionForm::enableTabBar(bool b) void TabBar::slotTabSelected(int id) { - QMap::const_iterator it; - it = m_idMap.find(id); + TQMap::const_iterator it; + it = m_idMap.tqfind(id); if(it != m_idMap.end()) emit tabSelected(*it); else @@ -141,7 +141,7 @@ void TabBar::show(void) if(m_signalType != SignalNormal) blockSignals(true); - QTabBar::show(); + TQTabBar::show(); if(m_signalType != SignalNormal) blockSignals(false); @@ -155,9 +155,9 @@ void TabBar::copyTabs(const TabBar* otabbar) } // now create new ones. copy text, icon and identifier for(int i=0; i < otabbar->count(); ++i) { - QTab* otab = otabbar->tabAt(i); - QTab* ntab = new QTab(otab->text()); - int nid = QTabBar::addTab(ntab); + TQTab* otab = otabbar->tabAt(i); + TQTab* ntab = new TQTab(otab->text()); + int nid = TQTabBar::addTab(ntab); m_idMap[nid] = otabbar->m_idMap[otab->identifier()]; ntab->setEnabled(otab->isEnabled()); if(otab->identifier() == otabbar->currentTab()) @@ -165,15 +165,15 @@ void TabBar::copyTabs(const TabBar* otabbar) } } -TransactionForm::TransactionForm(QWidget *parent, const char *name) : - TransactionEditorContainer(parent, name), +TransactionForm::TransactionForm(TQWidget *tqparent, const char *name) : + TransactionEditorContainer(tqparent, name), m_transaction(0), m_tabBar(0) { - setBackgroundOrigin(QTable::WindowOrigin); - setFrameShape( QTable::NoFrame); + setBackgroundOrigin(TQTable::WindowOrigin); + setFrameShape( TQTable::NoFrame); setShowGrid( false ); - setSelectionMode( QTable::NoSelection ); + setSelectionMode( TQTable::NoSelection ); verticalHeader()->hide(); horizontalHeader()->hide(); setLeftMargin(0); @@ -182,34 +182,34 @@ TransactionForm::TransactionForm(QWidget *parent, const char *name) : // make sure, that the table is 'invisible' by setting up the right background // keep the original color group for painting the cells though - QPalette p = palette(); - QColorGroup cg = p.active(); + TQPalette p = palette(); + TQColorGroup cg = p.active(); m_cellColorGroup = cg; - cg.setBrush(QColorGroup::Base, cg.brush(QColorGroup::Background)); + cg.setBrush(TQColorGroup::Base, cg.brush(TQColorGroup::Background)); p.setActive(cg); p.setInactive(cg); p.setDisabled(cg); setPalette(p); // never show vertical scroll bars - setVScrollBarMode(QScrollView::AlwaysOff); + setVScrollBarMode(TQScrollView::AlwaysOff); slotSetTransaction(0); } -void TransactionForm::drawContents( QPainter *p, int cx, int cy, int cw, int ch ) +void TransactionForm::drawContents( TQPainter *p, int cx, int cy, int cw, int ch ) { - // the QTable::drawContents() method does not honor the block update flag + // the TQTable::drawContents() method does not honor the block update flag // so we take care of it here - if ( testWState(WState_Visible|WState_BlockUpdates) != WState_Visible ) + if ( testWState((TQt::WidgetState)(WState_Visible|WState_BlockUpdates)) != WState_Visible ) return; - QTable::drawContents(p, cx, cy, cw, ch); + TQTable::drawContents(p, cx, cy, cw, ch); } bool TransactionForm::focusNextPrevChild(bool next) { - return QFrame::focusNextPrevChild(next); + return TQFrame::focusNextPrevChild(next); } void TransactionForm::clear(void) @@ -237,13 +237,13 @@ void TransactionForm::slotSetTransaction(KMyMoneyRegister::Transaction* transact kMyMoneyDateInput dateInput(0, "editDate"); KMyMoneyCategory category(0, "category", true); - // extract the maximal sizeHint height - int height = QMAX(dateInput.sizeHint().height(), category.sizeHint().height()); + // extract the maximal tqsizeHint height + int height = TQMAX(dateInput.tqsizeHint().height(), category.tqsizeHint().height()); for(int row = 0; row < numRows(); ++row) { if(!transaction || transaction->showRowInForm(row)) { showRow(row); - QTable::setRowHeight(row, height); + TQTable::setRowHeight(row, height); } else hideRow(row); } @@ -256,25 +256,25 @@ void TransactionForm::slotSetTransaction(KMyMoneyRegister::Transaction* transact setUpdatesEnabled(enabled); // force resizeing of the columns - QTimer::singleShot(0, this, SLOT(resize())); + TQTimer::singleShot(0, this, TQT_SLOT(resize())); } -void TransactionForm::paintCell(QPainter* painter, int row, int col, const QRect& r, bool selected, const QColorGroup& /* cg */) +void TransactionForm::paintCell(TQPainter* painter, int row, int col, const TQRect& r, bool selected, const TQColorGroup& /* cg */) { if(m_transaction) { m_transaction->paintFormCell(painter, row, col, r, selected, m_cellColorGroup); } } -TabBar* TransactionForm::tabBar(QWidget* parent) +TabBar* TransactionForm::tabBar(TQWidget* tqparent) { - if(!m_tabBar && parent) { + if(!m_tabBar && tqparent) { // determine the height of the objects in the table // create the tab bar - m_tabBar = new TabBar( parent ); + m_tabBar = new TabBar( tqparent ); m_tabBar->setSignalEmission(TabBar::SignalAlways); - m_tabBar->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, m_tabBar->sizePolicy().hasHeightForWidth() ) ); - connect(m_tabBar, SIGNAL(tabSelected(int)), this, SLOT(slotActionSelected(int))); + m_tabBar->tqsetSizePolicy( TQSizePolicy( (TQSizePolicy::SizeType)5, (TQSizePolicy::SizeType)0, 0, 0, m_tabBar->sizePolicy().hasHeightForWidth() ) ); + connect(m_tabBar, TQT_SIGNAL(tabSelected(int)), this, TQT_SLOT(slotActionSelected(int))); } return m_tabBar; } @@ -287,7 +287,7 @@ void TransactionForm::slotActionSelected(int id) void TransactionForm::setupForm(const MyMoneyAccount& acc) { // remove all tabs from the tabbar - QTab* tab; + TQTab* tab; for(tab = m_tabBar->tabAt(0); tab; tab = m_tabBar->tabAt(0)) { m_tabBar->removeTab(tab); } @@ -299,40 +299,40 @@ void TransactionForm::setupForm(const MyMoneyAccount& acc) // a different value switch(acc.accountType()) { default: - tab = new QTab(i18n("&Deposit")); + tab = new TQTab(i18n("&Deposit")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionDeposit); - tab = new QTab(i18n("&Transfer")); + tab = new TQTab(i18n("&Transfer")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionTransfer); - tab = new QTab(i18n("&Withdrawal")); + tab = new TQTab(i18n("&Withdrawal")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionWithdrawal); break; case MyMoneyAccount::CreditCard: - tab = new QTab(i18n("&Payment")); + tab = new TQTab(i18n("&Payment")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionDeposit); - tab = new QTab(i18n("&Transfer")); + tab = new TQTab(i18n("&Transfer")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionTransfer); - tab = new QTab(i18n("&Charge")); + tab = new TQTab(i18n("&Charge")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionWithdrawal); break; case MyMoneyAccount::Liability: case MyMoneyAccount::Loan: - tab = new QTab(i18n("&Decrease")); + tab = new TQTab(i18n("&Decrease")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionDeposit); - tab = new QTab(i18n("&Transfer")); + tab = new TQTab(i18n("&Transfer")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionTransfer); - tab = new QTab(i18n("&Increase")); + tab = new TQTab(i18n("&Increase")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionWithdrawal); break; case MyMoneyAccount::Asset: case MyMoneyAccount::AssetLoan: - tab = new QTab(i18n("&Increase")); + tab = new TQTab(i18n("&Increase")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionDeposit); - tab = new QTab(i18n("&Transfer")); + tab = new TQTab(i18n("&Transfer")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionTransfer); - tab = new QTab(i18n("&Decrease")); + tab = new TQTab(i18n("&Decrease")); m_tabBar->addTab(tab, KMyMoneyRegister::ActionWithdrawal); break; @@ -380,18 +380,18 @@ void TransactionForm::resize(int col) updateContents(); } -// needed to duplicate this here, as the QTable::tableSize method is private :-( -QSize TransactionForm::tableSize(void) const +// needed to duplicate this here, as the TQTable::tableSize method is private :-( +TQSize TransactionForm::tableSize(void) const { - return QSize(columnPos(numCols()-1) + columnWidth(numCols()-1) + 10, + return TQSize(columnPos(numCols()-1) + columnWidth(numCols()-1) + 10, rowPos(numRows()-1) + rowHeight(numRows()-1) + 10); } -QSize TransactionForm::sizeHint(void) const +TQSize TransactionForm::tqsizeHint(void) const { - // I've taken this from qtable.cpp, QTable::sizeHint() - int vmargin = QApplication::reverseLayout() ? rightMargin() : leftMargin(); - return QSize(tableSize().width() + vmargin + 5, tableSize().height() + topMargin() + 10); + // I've taken this from qtable.cpp, TQTable::tqsizeHint() + int vmargin = TQApplication::reverseLayout() ? rightMargin() : leftMargin(); + return TQSize(tableSize().width() + vmargin + 5, tableSize().height() + topMargin() + 10); } void TransactionForm::adjustColumn(Column col) @@ -403,22 +403,22 @@ void TransactionForm::adjustColumn(Column col) if(col == ValueColumn2) { kMyMoneyDateInput dateInput; kMyMoneyEdit valInput; - w = QMAX(dateInput.sizeHint().width(), valInput.sizeHint().width()); + w = TQMAX(dateInput.tqsizeHint().width(), valInput.tqsizeHint().width()); } if(m_transaction) { - QString txt; - QFontMetrics fontMetrics(KMyMoneyGlobalSettings::listCellFont()); + TQString txt; + TQFontMetrics fontMetrics(KMyMoneyGlobalSettings::listCellFont()); // scan through the rows for ( int i = numRows()-1; i >= 0; --i ) { int align; m_transaction->formCellText(txt, align, i, static_cast(col), 0); - QWidget* cw = cellWidget(i, col); + TQWidget* cw = cellWidget(i, col); if(cw) { - w = QMAX(w, cw->sizeHint().width()+10); + w = TQMAX(w, cw->tqsizeHint().width()+10); } - w = QMAX(w, fontMetrics.width(txt)+10); + w = TQMAX(w, fontMetrics.width(txt)+10); } } @@ -426,22 +426,22 @@ void TransactionForm::adjustColumn(Column col) setColumnWidth( col, w ); } -void TransactionForm::arrangeEditWidgets(QMap& editWidgets, KMyMoneyRegister::Transaction* t) +void TransactionForm::arrangeEditWidgets(TQMap& editWidgets, KMyMoneyRegister::Transaction* t) { t->arrangeWidgetsInForm(editWidgets); resize(ValueColumn1); } -void TransactionForm::tabOrder(QWidgetList& tabOrderWidgets, KMyMoneyRegister::Transaction* t) const +void TransactionForm::tabOrder(TQWidgetList& tabOrderWidgets, KMyMoneyRegister::Transaction* t) const { t->tabOrderInForm(tabOrderWidgets); } -void TransactionForm::removeEditWidgets(QMap& editWidgets) +void TransactionForm::removeEditWidgets(TQMap& editWidgets) { - QMap::iterator it; + TQMap::iterator it; for(it = editWidgets.begin(); it != editWidgets.end(); ) { - if((*it)->parentWidget() == this) { + if((*it)->tqparentWidget() == this) { editWidgets.remove(it); it = editWidgets.begin(); } else -- cgit v1.2.1