summaryrefslogtreecommitdiffstats
path: root/kmymoney2/widgets/transactionform.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-05 06:00:29 +0000
commitfecb0e67b23e8b83ba7fc881bb57bc48c0852d62 (patch)
tree6b8614802f0d01b353bc9ba78aff2090846c198e /kmymoney2/widgets/transactionform.cpp
parentdadc34655c3ab961b0b0b94a10eaaba710f0b5e8 (diff)
downloadkmymoney-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/transactionform.cpp')
-rw-r--r--kmymoney2/widgets/transactionform.cpp170
1 files changed, 85 insertions, 85 deletions
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 <qstring.h>
-#include <qpainter.h>
-#include <qtimer.h>
-#include <qapplication.h>
-#include <qlayout.h>
-#include <qtabbar.h>
-#include <qpalette.h>
+#include <tqstring.h>
+#include <tqpainter.h>
+#include <tqtimer.h>
+#include <tqapplication.h>
+#include <tqlayout.h>
+#include <tqtabbar.h>
+#include <tqpalette.h>
// ----------------------------------------------------------------------------
// 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<int, int>::const_iterator it;
- it = m_idMap.find(QTabBar::currentTab());
+ TQMap<int, int>::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<int, int>::const_iterator it;
+ TQTab *result=TQTabBar::tab(id);
+ TQMap<int, int>::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<int, int>::const_iterator it;
- it = m_idMap.find(id);
+ TQMap<int, int>::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<int>(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<QString, QWidget*>& editWidgets, KMyMoneyRegister::Transaction* t)
+void TransactionForm::arrangeEditWidgets(TQMap<TQString, TQWidget*>& 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<QString, QWidget*>& editWidgets)
+void TransactionForm::removeEditWidgets(TQMap<TQString, TQWidget*>& editWidgets)
{
- QMap<QString, QWidget*>::iterator it;
+ TQMap<TQString, TQWidget*>::iterator it;
for(it = editWidgets.begin(); it != editWidgets.end(); ) {
- if((*it)->parentWidget() == this) {
+ if((*it)->tqparentWidget() == this) {
editWidgets.remove(it);
it = editWidgets.begin();
} else