diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-07-02 06:40:27 +0000 |
commit | 2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch) | |
tree | 18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/gui/numberfieldwidget.cpp | |
parent | 1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff) | |
download | tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip |
TQt4 port tellico
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/numberfieldwidget.cpp')
-rw-r--r-- | src/gui/numberfieldwidget.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/gui/numberfieldwidget.cpp b/src/gui/numberfieldwidget.cpp index 027b1e9..9f249c6 100644 --- a/src/gui/numberfieldwidget.cpp +++ b/src/gui/numberfieldwidget.cpp @@ -17,13 +17,13 @@ #include <klineedit.h> -#include <qlayout.h> -#include <qvalidator.h> +#include <tqlayout.h> +#include <tqvalidator.h> using Tellico::GUI::NumberFieldWidget; -NumberFieldWidget::NumberFieldWidget(Data::FieldPtr field_, QWidget* parent_, const char* name_/*=0*/) - : FieldWidget(field_, parent_, name_), m_lineEdit(0), m_spinBox(0) { +NumberFieldWidget::NumberFieldWidget(Data::FieldPtr field_, TQWidget* tqparent_, const char* name_/*=0*/) + : FieldWidget(field_, tqparent_, name_), m_lineEdit(0), m_spinBox(0) { if(field_->flags() & Data::Field::AllowMultiple) { initLineEdit(); @@ -36,43 +36,43 @@ NumberFieldWidget::NumberFieldWidget(Data::FieldPtr field_, QWidget* parent_, co void NumberFieldWidget::initLineEdit() { m_lineEdit = new KLineEdit(this); - connect(m_lineEdit, SIGNAL(textChanged(const QString&)), SIGNAL(modified())); - // connect(kl, SIGNAL(returnPressed(const QString&)), this, SLOT(slotHandleReturn())); + connect(m_lineEdit, TQT_SIGNAL(textChanged(const TQString&)), TQT_SIGNAL(modified())); + // connect(kl, TQT_SIGNAL(returnPressed(const TQString&)), this, TQT_SLOT(slotHandleReturn())); // regexp is any number of digits followed optionally by any number of // groups of a semi-colon followed optionally by a space, followed by digits - QRegExp rx(QString::fromLatin1("-?\\d*(; ?-?\\d*)*")); - m_lineEdit->setValidator(new QRegExpValidator(rx, this)); + TQRegExp rx(TQString::tqfromLatin1("-?\\d*(; ?-?\\d*)*")); + m_lineEdit->setValidator(new TQRegExpValidator(rx, TQT_TQOBJECT(this))); } void NumberFieldWidget::initSpinBox() { // intentionally allow only positive numbers m_spinBox = new GUI::SpinBox(-1, INT_MAX, this); - connect(m_spinBox, SIGNAL(valueChanged(int)), SIGNAL(modified())); - // QSpinBox doesn't emit valueChanged if you edit the value with + connect(m_spinBox, TQT_SIGNAL(valueChanged(int)), TQT_SIGNAL(modified())); + // TQSpinBox doesn't emit valueChanged if you edit the value with // the lineEdit until you change the keyboard focus - connect(m_spinBox->child("qt_spinbox_edit"), SIGNAL(textChanged(const QString&)), SIGNAL(modified())); + connect(m_spinBox->child("qt_spinbox_edit"), TQT_SIGNAL(textChanged(const TQString&)), TQT_SIGNAL(modified())); // I want to allow no value, so set space as special text. Empty text is ignored - m_spinBox->setSpecialValueText(QChar(' ')); + m_spinBox->setSpecialValueText(TQChar(' ')); } -QString NumberFieldWidget::text() const { +TQString NumberFieldWidget::text() const { if(isSpinBox()) { // minValue = special empty text if(m_spinBox->value() > m_spinBox->minValue()) { - return QString::number(m_spinBox->value()); + return TQString::number(m_spinBox->value()); } - return QString(); + return TQString(); } - QString text = m_lineEdit->text(); + TQString text = m_lineEdit->text(); if(field()->flags() & Data::Field::AllowMultiple) { - text.replace(s_semiColon, QString::fromLatin1("; ")); + text.tqreplace(s_semiColon, TQString::tqfromLatin1("; ")); } return text.simplifyWhiteSpace(); } -void NumberFieldWidget::setText(const QString& text_) { +void NumberFieldWidget::setText(const TQString& text_) { blockSignals(true); if(isSpinBox()) { @@ -114,26 +114,26 @@ void NumberFieldWidget::updateFieldHook(Data::FieldPtr, Data::FieldPtr newField_ return; } - QString value = text(); + TQString value = text(); if(wasLineEdit && !nowLineEdit) { - layout()->remove(m_lineEdit); + tqlayout()->remove(m_lineEdit); delete m_lineEdit; m_lineEdit = 0; initSpinBox(); } else if(!wasLineEdit && nowLineEdit) { - layout()->remove(m_spinBox); + tqlayout()->remove(m_spinBox); delete m_spinBox; m_spinBox = 0; initLineEdit(); } // should really be FIELD_EDIT_WIDGET_INDEX from fieldwidget.cpp - static_cast<QBoxLayout*>(layout())->insertWidget(2, widget(), 1 /*stretch*/); + static_cast<TQBoxLayout*>(tqlayout())->insertWidget(2, widget(), 1 /*stretch*/); widget()->show(); setText(value); } -QWidget* NumberFieldWidget::widget() { +TQWidget* NumberFieldWidget::widget() { if(isSpinBox()) { return m_spinBox; } |