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/kguiutils.cpp | 100 ++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'kmymoney2/widgets/kguiutils.cpp') diff --git a/kmymoney2/widgets/kguiutils.cpp b/kmymoney2/widgets/kguiutils.cpp index c6157f9..f0e1d91 100644 --- a/kmymoney2/widgets/kguiutils.cpp +++ b/kmymoney2/widgets/kguiutils.cpp @@ -17,16 +17,16 @@ // ---------------------------------------------------------------------------- // QT Includes - // No need for QDateEdit, QSpinBox, etc., since these always return values + // No need for TQDateEdit, TQSpinBox, etc., since these always return values -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include // ---------------------------------------------------------------------------- // KDE Includes @@ -40,46 +40,46 @@ /************************************************************************** * * * The MandatoryFieldGroup code is courtesy of * - * Mark Summerfield in Qt Quarterly * + * Mark Summerfield in TQt Quarterly * * http://doc.trolltech.com/qq/qq11-mandatoryfields.html * * * * Enhanced by Thomas Baumgart to support the lineedit field of a * - * a QComboBox. * + * a TQComboBox. * * * **************************************************************************/ -void kMandatoryFieldGroup::add(QWidget *widget) +void kMandatoryFieldGroup::add(TQWidget *widget) { - if (!widgets.contains(widget)) { - if (widget->inherits("QCheckBox")) - connect((QCheckBox*)widget->qt_cast("QCheckBox"), - SIGNAL(clicked()), - this, SLOT(changed())); - - else if (widget->inherits("QComboBox")) { - QComboBox* combo = (QComboBox*)widget->qt_cast("QComboBox"); - QLineEdit* lineedit = combo->lineEdit(); + if (!widgets.tqcontains(widget)) { + if (widget->inherits(TQCHECKBOX_OBJECT_NAME_STRING)) + connect((TQCheckBox*)widget->qt_cast(TQCHECKBOX_OBJECT_NAME_STRING), + TQT_SIGNAL(clicked()), + this, TQT_SLOT(changed())); + + else if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING)) { + TQComboBox* combo = (TQComboBox*)widget->qt_cast(TQCOMBOBOX_OBJECT_NAME_STRING); + TQLineEdit* lineedit = combo->lineEdit(); if(lineedit) { - connect(lineedit, SIGNAL(textChanged(const QString&)), this, SLOT(changed())); + connect(lineedit, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(changed())); } else { - connect(combo, SIGNAL(highlighted(int)), this, SLOT(changed())); + connect(combo, TQT_SIGNAL(highlighted(int)), this, TQT_SLOT(changed())); } } - else if (widget->inherits("QLineEdit")) - connect((QLineEdit*)widget->qt_cast("QLineEdit"), - SIGNAL(textChanged(const QString&)), - this, SLOT(changed())); + else if (widget->inherits(TQLINEEDIT_OBJECT_NAME_STRING)) + connect((TQLineEdit*)widget->qt_cast(TQLINEEDIT_OBJECT_NAME_STRING), + TQT_SIGNAL(textChanged(const TQString&)), + this, TQT_SLOT(changed())); - else if (widget->inherits("QSpinBox")) - connect((QSpinBox*)widget->qt_cast("QSpinBox"), - SIGNAL(valueChanged(const QString&)), - this, SLOT(changed())); + else if (widget->inherits(TQSPINBOX_OBJECT_NAME_STRING)) + connect((TQSpinBox*)widget->qt_cast(TQSPINBOX_OBJECT_NAME_STRING), + TQT_SIGNAL(valueChanged(const TQString&)), + this, TQT_SLOT(changed())); - else if (widget->inherits("QListBox")) - connect((QListBox*)widget->qt_cast("QListBox"), - SIGNAL(selectionChanged()), - this, SLOT(changed())); + else if (widget->inherits(TQLISTBOX_OBJECT_NAME_STRING)) + connect((TQListBox*)widget->qt_cast(TQLISTBOX_OBJECT_NAME_STRING), + TQT_SIGNAL(selectionChanged()), + this, TQT_SLOT(changed())); else { qWarning("MandatoryFieldGroup: unsupported class %s", @@ -94,15 +94,15 @@ void kMandatoryFieldGroup::add(QWidget *widget) } -void kMandatoryFieldGroup::remove(QWidget *widget) +void kMandatoryFieldGroup::remove(TQWidget *widget) { - widget->setPaletteBackgroundColor(widget->colorGroup().background()); + widget->setPaletteBackgroundColor(widget->tqcolorGroup().background()); widgets.remove(widget); changed(); } -void kMandatoryFieldGroup::setOkButton(QPushButton *button) +void kMandatoryFieldGroup::setOkButton(TQPushButton *button) { if (okButton && okButton != button) okButton->setEnabled(true); @@ -114,36 +114,36 @@ void kMandatoryFieldGroup::setOkButton(QPushButton *button) void kMandatoryFieldGroup::changed(void) { bool enable = true; - QValueList::ConstIterator i; + TQValueList::ConstIterator i; for (i = widgets.begin(); i != widgets.end(); ++i) { - QWidget *widget = *i; + TQWidget *widget = *i; // disabled widgets don't count if(!(widget->isEnabled())) { continue; } - if (widget->inherits("QCheckBox")) { - if (((QCheckBox*)widget->qt_cast("QCheckBox"))->state() == QButton::NoChange) { + if (widget->inherits(TQCHECKBOX_OBJECT_NAME_STRING)) { + if (((TQCheckBox*)widget->qt_cast(TQCHECKBOX_OBJECT_NAME_STRING))->state() == TQButton::NoChange) { enable = false; break; } else continue; } - if (widget->inherits("QComboBox")) { - if (((QComboBox*)widget->qt_cast("QComboBox"))->currentText().isEmpty()) { + if (widget->inherits(TQCOMBOBOX_OBJECT_NAME_STRING)) { + if (((TQComboBox*)widget->qt_cast(TQCOMBOBOX_OBJECT_NAME_STRING))->currentText().isEmpty()) { enable = false; break; } else continue; } - if (widget->inherits("QLineEdit")) { - if (((QLineEdit*)widget->qt_cast("QLineEdit"))->text().isEmpty()) { + if (widget->inherits(TQLINEEDIT_OBJECT_NAME_STRING)) { + if (((TQLineEdit*)widget->qt_cast(TQLINEEDIT_OBJECT_NAME_STRING))->text().isEmpty()) { enable = false; break; } else continue; } - if (widget->inherits("QListBox")) { - if (((QListBox*)widget->qt_cast("QListBox"))->selectedItem() == 0) { + if (widget->inherits(TQLISTBOX_OBJECT_NAME_STRING)) { + if (((TQListBox*)widget->qt_cast(TQLISTBOX_OBJECT_NAME_STRING))->selectedItem() == 0) { enable = false; break; } else @@ -162,9 +162,9 @@ void kMandatoryFieldGroup::changed(void) void kMandatoryFieldGroup::clear(void) { - QValueList::Iterator i; + TQValueList::Iterator i; for (i = widgets.begin(); i != widgets.end(); ++i) - (*i)->setPaletteBackgroundColor((*i)->colorGroup().background()); + (*i)->setPaletteBackgroundColor((*i)->tqcolorGroup().background()); widgets.clear(); if (okButton) { okButton->setEnabled(true); -- cgit v1.2.1