diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /lib/koproperty/editors/booledit.cpp | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/koproperty/editors/booledit.cpp')
-rw-r--r-- | lib/koproperty/editors/booledit.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/lib/koproperty/editors/booledit.cpp b/lib/koproperty/editors/booledit.cpp index 67fb82ec..5c347c02 100644 --- a/lib/koproperty/editors/booledit.cpp +++ b/lib/koproperty/editors/booledit.cpp @@ -27,48 +27,48 @@ #include <kcombobox.h> #include <kdebug.h> -#include <qtoolbutton.h> -#include <qpainter.h> -#include <qvariant.h> -#include <qlayout.h> -#include <qbitmap.h> +#include <tqtoolbutton.h> +#include <tqpainter.h> +#include <tqvariant.h> +#include <tqlayout.h> +#include <tqbitmap.h> using namespace KoProperty; -BoolEdit::BoolEdit(Property *property, QWidget *parent, const char *name) - : Widget(property, parent, name) +BoolEdit::BoolEdit(Property *property, TQWidget *tqparent, const char *name) + : Widget(property, tqparent, name) , m_yesIcon( SmallIcon("button_ok") ) , m_noIcon( SmallIcon("button_no") ) { - m_toggle = new QToolButton(this); + m_toggle = new TQToolButton(this); m_toggle->setToggleButton( true ); - m_toggle->setFocusPolicy(QWidget::WheelFocus); + m_toggle->setFocusPolicy(TQ_WheelFocus); m_toggle->setUsesTextLabel(true); - m_toggle->setTextPosition(QToolButton::Right); - m_toggle->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - //we're not using layout to because of problems with button size + m_toggle->setTextPosition(TQToolButton::Right); + m_toggle->tqsetSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Fixed); + //we're not using tqlayout to because of problems with button size m_toggle->move(0, 0); m_toggle->resize(width(), height()); setFocusWidget(m_toggle); - connect(m_toggle, SIGNAL(stateChanged(int)), this, SLOT(slotValueChanged(int))); + connect(m_toggle, TQT_SIGNAL(stateChanged(int)), this, TQT_SLOT(slotValueChanged(int))); } BoolEdit::~BoolEdit() { } -QVariant +TQVariant BoolEdit::value() const { - return QVariant(m_toggle->isOn(), 4); + return TQVariant(m_toggle->isOn(), 4); } void -BoolEdit::setValue(const QVariant &value, bool emitChange) +BoolEdit::setValue(const TQVariant &value, bool emitChange) { m_toggle->blockSignals(true); m_toggle->setOn(value.toBool()); - setState( value.toBool() ? QButton::On : QButton::Off ); + setState( value.toBool() ? TQButton::On : TQButton::Off ); m_toggle->blockSignals(false); if (emitChange) emit valueChanged(this); @@ -81,28 +81,28 @@ BoolEdit::slotValueChanged(int state) emit valueChanged(this); } -static void drawViewerInternal(QPainter *p, const QRect &r, const QVariant &value, - const QPixmap& yesIcon, const QPixmap& noIcon, const QString& nullText) +static void drawViewerInternal(TQPainter *p, const TQRect &r, const TQVariant &value, + const TQPixmap& yesIcon, const TQPixmap& noIcon, const TQString& nullText) { p->eraseRect(r); - QRect r2(r); + TQRect r2(r); r2.moveLeft(KIcon::SizeSmall + 6); if(value.isNull() && !nullText.isEmpty()) { - p->drawText(r2, Qt::AlignVCenter | Qt::AlignLeft, nullText); + p->drawText(r2, TQt::AlignVCenter | TQt::AlignLeft, nullText); } else if(value.toBool()) { p->drawPixmap(3, (r.height()-1-KIcon::SizeSmall)/2, yesIcon); - p->drawText(r2, Qt::AlignVCenter | Qt::AlignLeft, i18n("Yes")); + p->drawText(r2, TQt::AlignVCenter | TQt::AlignLeft, i18n("Yes")); } else { p->drawPixmap(3, (r.height()-1-KIcon::SizeSmall)/2, noIcon); - p->drawText(r2, Qt::AlignVCenter | Qt::AlignLeft, i18n("No")); + p->drawText(r2, TQt::AlignVCenter | TQt::AlignLeft, i18n("No")); } } void -BoolEdit::drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value) +BoolEdit::drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value) { Q_UNUSED(cg); drawViewerInternal(p, r, value, m_yesIcon, m_noIcon, ""); @@ -111,29 +111,29 @@ BoolEdit::drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const Q void BoolEdit::setState(int state) { - if(QButton::On == state) { - m_toggle->setIconSet(QIconSet(m_yesIcon)); + if(TQButton::On == state) { + m_toggle->setIconSet(TQIconSet(m_yesIcon)); m_toggle->setTextLabel(i18n("Yes")); } - else if (QButton::Off == state) { - m_toggle->setIconSet(QIconSet(m_noIcon)); + else if (TQButton::Off == state) { + m_toggle->setIconSet(TQIconSet(m_noIcon)); m_toggle->setTextLabel(i18n("No")); } } void -BoolEdit::resizeEvent(QResizeEvent *ev) +BoolEdit::resizeEvent(TQResizeEvent *ev) { m_toggle->resize(ev->size()); } bool -BoolEdit::eventFilter(QObject* watched, QEvent* e) +BoolEdit::eventFilter(TQObject* watched, TQEvent* e) { - if(e->type() == QEvent::KeyPress) { - QKeyEvent* ev = static_cast<QKeyEvent*>(e); + if(e->type() == TQEvent::KeyPress) { + TQKeyEvent* ev = TQT_TQKEYEVENT(e); const int k = ev->key(); - if(k == Qt::Key_Space || k == Qt::Key_Enter || k == Qt::Key_Return) { + if(k == TQt::Key_Space || k == TQt::Key_Enter || k == TQt::Key_Return) { if (m_toggle) m_toggle->toggle(); return true; @@ -150,16 +150,16 @@ BoolEdit::setReadOnlyInternal(bool readOnly) //-------------------------------------------------- -ThreeStateBoolEdit::ThreeStateBoolEdit(Property *property, QWidget *parent, const char *name) - : ComboBox(property, parent, name) +ThreeStateBoolEdit::ThreeStateBoolEdit(Property *property, TQWidget *tqparent, const char *name) + : ComboBox(property, tqparent, name) , m_yesIcon( SmallIcon("button_ok") ) , m_noIcon( SmallIcon("button_no") ) { m_edit->insertItem( m_yesIcon, i18n("Yes") ); m_edit->insertItem( m_noIcon, i18n("No") ); - QVariant thirdState = property ? property->option("3rdState") : QVariant(); - QPixmap nullIcon( m_yesIcon.size() ); //transparent pixmap of appropriate size - nullIcon.setMask(QBitmap(m_yesIcon.size(), true)); + TQVariant thirdState = property ? property->option("3rdState") : TQVariant(); + TQPixmap nullIcon( m_yesIcon.size() ); //transparent pixmap of appropriate size + nullIcon.setMask(TQBitmap(m_yesIcon.size(), true)); m_edit->insertItem( nullIcon, thirdState.toString().isEmpty() ? i18n("None") : thirdState.toString() ); } @@ -167,15 +167,15 @@ ThreeStateBoolEdit::~ThreeStateBoolEdit() { } -QVariant +TQVariant ThreeStateBoolEdit::value() const { // list items: true, false, NULL const int idx = m_edit->currentItem(); if (idx==0) - return QVariant(true, 1); + return TQVariant(true, 1); else - return idx==1 ? QVariant(false) : QVariant(); + return idx==1 ? TQVariant(false) : TQVariant(); } void @@ -189,7 +189,7 @@ ThreeStateBoolEdit::setProperty(Property *prop) } void -ThreeStateBoolEdit::setValue(const QVariant &value, bool emitChange) +ThreeStateBoolEdit::setValue(const TQVariant &value, bool emitChange) { if (!m_setValueEnabled) return; @@ -204,7 +204,7 @@ ThreeStateBoolEdit::setValue(const QVariant &value, bool emitChange) } void -ThreeStateBoolEdit::drawViewer(QPainter *p, const QColorGroup &cg, const QRect &r, const QVariant &value) +ThreeStateBoolEdit::drawViewer(TQPainter *p, const TQColorGroup &cg, const TQRect &r, const TQVariant &value) { Q_UNUSED(cg); drawViewerInternal(p, r, value, m_yesIcon, m_noIcon, m_edit->text(2)); |