diff options
Diffstat (limited to 'lib/koproperty/editors/spinbox.cpp')
-rw-r--r-- | lib/koproperty/editors/spinbox.cpp | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/lib/koproperty/editors/spinbox.cpp b/lib/koproperty/editors/spinbox.cpp index 2e4bcc7c3..b90485bb8 100644 --- a/lib/koproperty/editors/spinbox.cpp +++ b/lib/koproperty/editors/spinbox.cpp @@ -22,33 +22,33 @@ #include "property.h" -#include <qlayout.h> -#include <qobjectlist.h> -#include <qvariant.h> -#include <qpainter.h> -#include <qlineedit.h> +#include <tqlayout.h> +#include <tqobjectlist.h> +#include <tqvariant.h> +#include <tqpainter.h> +#include <tqlineedit.h> #include <kglobal.h> #include <klocale.h> using namespace KoProperty; -IntSpinBox::IntSpinBox(int lower, int upper, int step, int value, int base, IntEdit *parent, const char *name) -: KIntSpinBox(lower, upper, step, value, base, parent, name) +IntSpinBox::IntSpinBox(int lower, int upper, int step, int value, int base, IntEdit *tqparent, const char *name) +: KIntSpinBox(lower, upper, step, value, base, tqparent, name) { - editor()->setAlignment(Qt::AlignLeft); + editor()->tqsetAlignment(TQt::AlignLeft); installEventFilter(editor()); installEventFilter(this); - QObjectList *spinwidgets = queryList( "QSpinWidget", 0, false, true ); - QSpinWidget* spin = static_cast<QSpinWidget*>(spinwidgets->first()); + TQObjectList *spinwidgets = queryList( TQSPINWIDGET_OBJECT_NAME_STRING, 0, false, true ); + TQSpinWidget* spin = static_cast<TQSpinWidget*>(TQT_TQWIDGET(spinwidgets->first())); if (spin) spin->installEventFilter(this); delete spinwidgets; } -void IntSpinBox::setValue(const QVariant &value) +void IntSpinBox::setValue(const TQVariant &value) { - if (dynamic_cast<IntEdit*>(parentWidget()) && dynamic_cast<IntEdit*>(parentWidget())->isReadOnly()) + if (dynamic_cast<IntEdit*>(tqparentWidget()) && dynamic_cast<IntEdit*>(tqparentWidget())->isReadOnly()) return; if (value.isNull()) editor()->clear(); @@ -57,22 +57,22 @@ void IntSpinBox::setValue(const QVariant &value) } bool -IntSpinBox::eventFilter(QObject *o, QEvent *e) +IntSpinBox::eventFilter(TQObject *o, TQEvent *e) { - if(o == editor()) + if(TQT_BASE_OBJECT(o) == editor()) { - if(e->type() == QEvent::KeyPress) + if(e->type() == TQEvent::KeyPress) { - QKeyEvent* ev = static_cast<QKeyEvent*>(e); + TQKeyEvent* ev = TQT_TQKEYEVENT(e); if((ev->key()==Key_Up || ev->key()==Key_Down) && ev->state() !=ControlButton) { - parentWidget()->eventFilter(o, e); + tqparentWidget()->eventFilter(o, e); return true; } } } - if ((o == editor() || o == this || o->parent() == this) - && e->type() == QEvent::Wheel && static_cast<IntEdit*>(parentWidget())->isReadOnly()) + if ((TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(editor()) || TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(this) || TQT_BASE_OBJECT(o->tqparent()) == TQT_BASE_OBJECT(this)) + && e->type() == TQEvent::Wheel && static_cast<IntEdit*>(tqparentWidget())->isReadOnly()) { return true; //avoid value changes for read-only widget } @@ -83,12 +83,12 @@ IntSpinBox::eventFilter(QObject *o, QEvent *e) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// -IntEdit::IntEdit(Property *property, QWidget *parent, const char *name) - : Widget(property, parent, name) +IntEdit::IntEdit(Property *property, TQWidget *tqparent, const char *name) + : Widget(property, tqparent, name) { - QVariant minVal( property ? property->option("min") : 0 ); - QVariant maxVal( property ? property->option("max") : QVariant() ); - QVariant minValueText( property ? property->option("minValueText") : QVariant() ); + TQVariant minVal( property ? property->option("min") : 0 ); + TQVariant maxVal( property ? property->option("max") : TQVariant() ); + TQVariant minValueText( property ? property->option("minValueText") : TQVariant() ); if (minVal.isNull()) minVal = 0; if (maxVal.isNull()) @@ -102,22 +102,22 @@ IntEdit::IntEdit(Property *property, QWidget *parent, const char *name) setLeavesTheSpaceForRevertButton(true); setFocusWidget(m_edit); - connect(m_edit, SIGNAL(valueChanged(int)), this, SLOT(slotValueChanged(int))); + connect(m_edit, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotValueChanged(int))); } IntEdit::~IntEdit() {} -QVariant +TQVariant IntEdit::value() const { if (m_edit->cleanText().isEmpty()) - return QVariant(); + return TQVariant(); return m_edit->value(); } void -IntEdit::setValue(const QVariant &value, bool emitChange) +IntEdit::setValue(const TQVariant &value, bool emitChange) { m_edit->blockSignals(true); m_edit->setValue(value); @@ -128,13 +128,13 @@ IntEdit::setValue(const QVariant &value, bool emitChange) } void -IntEdit::drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value) +IntEdit::drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value) { - QString valueText = value.toString(); + TQString valueText = value.toString(); if (property() && property()->hasOptions()) { //replace min value with minValueText if defined - QVariant minValue( property()->option("min") ); - QVariant minValueText( property()->option("minValueText") ); + TQVariant minValue( property()->option("min") ); + TQVariant minValueText( property()->option("minValueText") ); if (!minValue.isNull() && !minValueText.isNull() && minValue.toInt() == value.toInt()) { valueText = minValueText.toString(); } @@ -142,7 +142,7 @@ IntEdit::drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QV Widget::drawViewer(p, cg, r, valueText); // p->eraseRect(r); -// p->drawText(r, Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, valueText); +// p->drawText(r, TQt::AlignLeft | TQt::AlignVCenter | TQt::SingleLine, valueText); } void @@ -154,8 +154,8 @@ IntEdit::slotValueChanged(int) void IntEdit::updateSpinWidgets() { - QObjectList *spinwidgets = queryList( "QSpinWidget", 0, false, true ); - QSpinWidget* spin = static_cast<QSpinWidget*>(spinwidgets->first()); + TQObjectList *spinwidgets = queryList( TQSPINWIDGET_OBJECT_NAME_STRING, 0, false, true ); + TQSpinWidget* spin = static_cast<TQSpinWidget*>(TQT_TQWIDGET(spinwidgets->first())); if (spin) { spin->setUpEnabled(!isReadOnly()); spin->setDownEnabled(!isReadOnly()); @@ -176,36 +176,36 @@ IntEdit::setReadOnlyInternal(bool readOnly) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// -DoubleSpinBox::DoubleSpinBox (double lower, double upper, double step, double value, int precision, DoubleEdit *parent) -: KDoubleSpinBox(lower, upper, step, value, precision, parent) +DoubleSpinBox::DoubleSpinBox (double lower, double upper, double step, double value, int precision, DoubleEdit *tqparent) +: KDoubleSpinBox(lower, upper, step, value, precision, tqparent) { - editor()->setAlignment(Qt::AlignLeft); + editor()->tqsetAlignment(TQt::AlignLeft); installEventFilter(editor()); installEventFilter(this); - QObjectList *spinwidgets = queryList( "QSpinWidget", 0, false, true ); - QSpinWidget* spin = static_cast<QSpinWidget*>(spinwidgets->first()); + TQObjectList *spinwidgets = queryList( TQSPINWIDGET_OBJECT_NAME_STRING, 0, false, true ); + TQSpinWidget* spin = static_cast<TQSpinWidget*>(TQT_TQWIDGET(spinwidgets->first())); if (spin) spin->installEventFilter(this); delete spinwidgets; } bool -DoubleSpinBox::eventFilter(QObject *o, QEvent *e) +DoubleSpinBox::eventFilter(TQObject *o, TQEvent *e) { - if(o == editor()) + if(TQT_BASE_OBJECT(o) == editor()) { - if(e->type() == QEvent::KeyPress) + if(e->type() == TQEvent::KeyPress) { - QKeyEvent* ev = static_cast<QKeyEvent*>(e); + TQKeyEvent* ev = TQT_TQKEYEVENT(e); if((ev->key()==Key_Up || ev->key()==Key_Down) && ev->state()!=ControlButton) { - parentWidget()->eventFilter(o, e); + tqparentWidget()->eventFilter(o, e); return true; } } } - if ((o == editor() || o == this || o->parent() == this) - && e->type() == QEvent::Wheel && static_cast<IntEdit*>(parentWidget())->isReadOnly()) + if ((TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(editor()) || TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(this) || TQT_BASE_OBJECT(o->tqparent()) == TQT_BASE_OBJECT(this)) + && e->type() == TQEvent::Wheel && static_cast<IntEdit*>(tqparentWidget())->isReadOnly()) { return true; //avoid value changes for read-only widget } @@ -214,9 +214,9 @@ DoubleSpinBox::eventFilter(QObject *o, QEvent *e) } -void DoubleSpinBox::setValue( const QVariant& value ) +void DoubleSpinBox::setValue( const TQVariant& value ) { - if (dynamic_cast<DoubleEdit*>(parentWidget()) && dynamic_cast<DoubleEdit*>(parentWidget())->isReadOnly()) + if (dynamic_cast<DoubleEdit*>(tqparentWidget()) && dynamic_cast<DoubleEdit*>(tqparentWidget())->isReadOnly()) return; if (value.isNull()) editor()->clear(); @@ -226,14 +226,14 @@ void DoubleSpinBox::setValue( const QVariant& value ) ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// -DoubleEdit::DoubleEdit(Property *property, QWidget *parent, const char *name) - : Widget(property, parent, name) +DoubleEdit::DoubleEdit(Property *property, TQWidget *tqparent, const char *name) + : Widget(property, tqparent, name) { - QVariant minVal( property ? property->option("min") : 0 ); - QVariant maxVal( property ? property->option("max") : QVariant() ); - QVariant step( property ? property->option("step") : QVariant()); - QVariant precision( property ? property->option("precision") : QVariant()); - QVariant minValueText( property ? property->option("minValueText") : QVariant() ); + TQVariant minVal( property ? property->option("min") : 0 ); + TQVariant maxVal( property ? property->option("max") : TQVariant() ); + TQVariant step( property ? property->option("step") : TQVariant()); + TQVariant precision( property ? property->option("precision") : TQVariant()); + TQVariant minValueText( property ? property->option("minValueText") : TQVariant() ); if (minVal.isNull()) minVal = 0; if (maxVal.isNull()) @@ -247,28 +247,28 @@ DoubleEdit::DoubleEdit(Property *property, QWidget *parent, const char *name) 0, precision.toInt(), this); if (!minValueText.isNull()) m_edit->setSpecialValueText(minValueText.toString()); - m_edit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + m_edit->tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding); m_edit->setMinimumHeight(5); setEditor(m_edit); setLeavesTheSpaceForRevertButton(true); setFocusWidget(m_edit); - connect(m_edit, SIGNAL(valueChanged(double)), this, SLOT(slotValueChanged(double))); + connect(m_edit, TQT_SIGNAL(valueChanged(double)), this, TQT_SLOT(slotValueChanged(double))); } DoubleEdit::~DoubleEdit() {} -QVariant +TQVariant DoubleEdit::value() const { if (m_edit->cleanText().isEmpty()) - return QVariant(); + return TQVariant(); return m_edit->value(); } void -DoubleEdit::setValue(const QVariant &value, bool emitChange) +DoubleEdit::setValue(const TQVariant &value, bool emitChange) { m_edit->blockSignals(true); m_edit->setValue(value); @@ -279,23 +279,23 @@ DoubleEdit::setValue(const QVariant &value, bool emitChange) } void -DoubleEdit::drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value) +DoubleEdit::drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value) { - QString valueText; + TQString valueText; if (property() && property()->hasOptions()) { //replace min value with minValueText if defined - QVariant minValue( property()->option("min") ); - QVariant minValueText( property()->option("minValueText") ); + TQVariant minValue( property()->option("min") ); + TQVariant minValueText( property()->option("minValueText") ); if (!minValue.isNull() && !minValueText.isNull() && minValue.toString().toDouble() == value.toString().toDouble()) { valueText = minValueText.toString(); } } if (valueText.isEmpty()) - valueText = QString(value.toString()).replace('.', KGlobal::locale()->decimalSymbol()); + valueText = TQString(value.toString()).tqreplace('.', KGlobal::locale()->decimalSymbol()); Widget::drawViewer(p, cg, r, valueText); // p->eraseRect(r); -// p->drawText(r, Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, valueText); +// p->drawText(r, TQt::AlignLeft | TQt::AlignVCenter | TQt::SingleLine, valueText); } void @@ -307,8 +307,8 @@ DoubleEdit::slotValueChanged(double) void DoubleEdit::updateSpinWidgets() { - QObjectList *spinwidgets = queryList( "QSpinWidget", 0, false, true ); - QSpinWidget* spin = static_cast<QSpinWidget*>(spinwidgets->first()); + TQObjectList *spinwidgets = queryList( TQSPINWIDGET_OBJECT_NAME_STRING, 0, false, true ); + TQSpinWidget* spin = static_cast<TQSpinWidget*>(TQT_TQWIDGET(spinwidgets->first())); if (spin) { spin->setUpEnabled(!isReadOnly()); spin->setDownEnabled(!isReadOnly()); |