diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-30 00:15:53 +0000 |
commit | 0aaa8e3fc8f8a1481333b564f0922277c8d8ad59 (patch) | |
tree | b95c0ca86c4876dd139af376b9f4afd8917cf0cd /src/common/gui/number_gui.cpp | |
parent | b79a2c28534cf09987eeeba3077fff9236df182a (diff) | |
download | piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.tar.gz piklab-0aaa8e3fc8f8a1481333b564f0922277c8d8ad59.zip |
TQt4 port piklab
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1238822 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/common/gui/number_gui.cpp')
-rw-r--r-- | src/common/gui/number_gui.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/common/gui/number_gui.cpp b/src/common/gui/number_gui.cpp index d855407..1a84a36 100644 --- a/src/common/gui/number_gui.cpp +++ b/src/common/gui/number_gui.cpp @@ -8,65 +8,65 @@ ***************************************************************************/ #include "number_gui.h" -#include <qfontmetrics.h> +#include <tqfontmetrics.h> //----------------------------------------------------------------------------- -uint maxCharWidth(const QString &s, const QFont &font) +uint maxCharWidth(const TQString &s, const TQFont &font) { - QFontMetrics fm(font); + TQFontMetrics fm(font); uint w = 0; for (uint i=0; i<uint(s.length()); i++) - w = QMAX(w, uint(fm.width(s[i]))); + w = TQMAX(w, uint(fm.width(s[i]))); return w; } -uint maxCharWidth(NumberBase base, const QFont &font) +uint maxCharWidth(NumberBase base, const TQFont &font) { - QString s; + TQString s; for (uint i=0; i<base.data().base; i++) s += toChar(base, i); return maxCharWidth(s, font); } -uint maxLabelWidth(NumberBase base, uint nbChars, const QFont &font) +uint maxLabelWidth(NumberBase base, uint nbChars, const TQFont &font) { uint w = maxStringWidth(base, nbChars, font); - QFontMetrics fm(font); + TQFontMetrics fm(font); if ( base==NumberBase::String ) return w + 2 * fm.width("\""); return w + fm.width(base.data().prefix); } //----------------------------------------------------------------------------- -NumberLineEdit::NumberLineEdit(QWidget *parent, const char *name) - : KLineEdit(parent, name) +NumberLineEdit::NumberLineEdit(TQWidget *tqparent, const char *name) + : KLineEdit(tqparent, name) { - connect(this, SIGNAL(textChanged(const QString &)), SLOT(textChangedSlot())); + connect(this, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(textChangedSlot())); } -NumberLineEdit::NumberLineEdit(const QString &text, QWidget *parent, const char *name) - : KLineEdit(text, parent, name) +NumberLineEdit::NumberLineEdit(const TQString &text, TQWidget *tqparent, const char *name) + : KLineEdit(text, tqparent, name) { - connect(this, SIGNAL(textChanged(const QString &)), SLOT(textChangedSlot())); + connect(this, TQT_SIGNAL(textChanged(const TQString &)), TQT_SLOT(textChangedSlot())); } -QValidator::State validateNumber(const QString &input) +TQValidator::State validateNumber(const TQString &input) { - if ( input.isEmpty() ) return QValidator::Intermediate; + if ( input.isEmpty() ) return TQValidator::Intermediate; bool ok; (void)fromAnyLabel(input, &ok); - if (ok) return QValidator::Acceptable; + if (ok) return TQValidator::Acceptable; FOR_EACH(NumberBase, base) - if ( input==base.data().prefix ) return QValidator::Intermediate; - if ( input[0]=='\"' ) return QValidator::Intermediate; - if ( input[0]=='\'' ) return QValidator::Intermediate; - return QValidator::Invalid; + if ( input==base.data().prefix ) return TQValidator::Intermediate; + if ( input[0]=='\"' ) return TQValidator::Intermediate; + if ( input[0]=='\'' ) return TQValidator::Intermediate; + return TQValidator::Invalid; } void NumberLineEdit::textChangedSlot() { - QValidator::State state = validateNumber(text()); + TQValidator::State state = validateNumber(text()); switch (state) { - case QValidator::Acceptable: unsetColor(); break; - case QValidator::Intermediate: setColor(QColor("#FF9900")); break; - case QValidator::Invalid: setColor(red); break; + case TQValidator::Acceptable: unsetColor(); break; + case TQValidator::Intermediate: setColor(TQColor("#FF9900")); break; + case TQValidator::Invalid: setColor(red); break; } } |