summaryrefslogtreecommitdiffstats
path: root/src/gui/doublespinbox.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-29 16:05:55 +0000
commit87a016680e3677da3993f333561e79eb0cead7d5 (patch)
treecbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/gui/doublespinbox.cpp
parent6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff)
downloadktechlab-87a016680e3677da3993f333561e79eb0cead7d5.tar.gz
ktechlab-87a016680e3677da3993f333561e79eb0cead7d5.zip
TQt4 port ktechlab
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1238801 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/doublespinbox.cpp')
-rw-r--r--src/gui/doublespinbox.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/gui/doublespinbox.cpp b/src/gui/doublespinbox.cpp
index b8672b5..fb5efa4 100644
--- a/src/gui/doublespinbox.cpp
+++ b/src/gui/doublespinbox.cpp
@@ -15,9 +15,9 @@
#include <kglobal.h>
#include <klocale.h>
-#include <qlineedit.h>
-#include <qregexp.h>
-#include <qtimer.h>
+#include <tqlineedit.h>
+#include <tqregexp.h>
+#include <tqtimer.h>
#include <algorithm>
#include <cmath>
@@ -30,21 +30,21 @@ inline int roundDouble( double val )
}
-DoubleSpinBox::DoubleSpinBox( double lower, double upper, double minAbs, double value, const QString &unit, QWidget * parent )
- : QSpinBox( parent )
+DoubleSpinBox::DoubleSpinBox( double lower, double upper, double minAbs, double value, const TQString &unit, TQWidget * tqparent )
+ : TQSpinBox( tqparent )
{
m_lastEmittedValue = value;
m_unit = unit;
m_minValue = lower;
m_maxValue = upper;
m_minAbsValue = minAbs;
- m_queuedSuffix = QString::null;
+ m_queuedSuffix = TQString();
- editor()->setAlignment( Qt::AlignRight );
+ editor()->tqsetAlignment( TQt::AlignRight );
- connect( this, SIGNAL(valueChanged(int)), this, SLOT(checkIfChanged()) );
- QSpinBox::setMinValue( -(1<<30) );
- QSpinBox::setMaxValue( +(1<<30) );
+ connect( this, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(checkIfChanged()) );
+ TQSpinBox::setMinValue( -(1<<30) );
+ TQSpinBox::setMaxValue( +(1<<30) );
setValue( value );
setValidator( 0 );
@@ -75,11 +75,11 @@ void DoubleSpinBox::setValue( double value )
updateSuffix( value );
- QSpinBox::setValue( roundDouble( (value / Item::getMultiplier( value )) * 100 ) );
+ TQSpinBox::setValue( roundDouble( (value / Item::getMultiplier( value )) * 100 ) );
}
-void DoubleSpinBox::setUnit( const QString & unit )
+void DoubleSpinBox::setUnit( const TQString & unit )
{
updateSuffix( value() );
m_unit = unit;
@@ -94,7 +94,7 @@ void DoubleSpinBox::updateSuffix( double value )
if ( m_queuedSuffix.stripWhiteSpace().isEmpty() )
m_queuedSuffix = "";
- QTimer::singleShot( 0, this, SLOT(setQueuedSuffix()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(setQueuedSuffix()) );
}
@@ -106,7 +106,7 @@ void DoubleSpinBox::setQueuedSuffix()
setSuffix( m_queuedSuffix );
changed = true;
}
- m_queuedSuffix = QString::null;
+ m_queuedSuffix = TQString();
if ( changed )
emit valueChanged( value() );
@@ -115,29 +115,29 @@ void DoubleSpinBox::setQueuedSuffix()
double DoubleSpinBox::getMult()
{
- QString text = this->text().stripWhiteSpace();
+ TQString text = this->text().stripWhiteSpace();
if ( !m_queuedSuffix.isNull() )
{
- QString nsSuffix = suffix().stripWhiteSpace();
+ TQString nsSuffix = suffix().stripWhiteSpace();
if ( nsSuffix.isEmpty() )
text.append( m_queuedSuffix );
else
- text.replace( nsSuffix, m_queuedSuffix );
+ text.tqreplace( nsSuffix, m_queuedSuffix );
}
if ( text.length() == 0 )
return 1.0;
- if ( text.endsWith( m_unit, false ) )
+ if ( text.tqendsWith( m_unit, false ) )
text = text.remove( text.length() - m_unit.length(), m_unit.length() );
text.stripWhiteSpace();
- QChar siExp = text[ text.length()-1 ];
+ TQChar siExp = text[ text.length()-1 ];
if ( siExp.isLetter() || siExp.isSymbol() )
- return CNItem::getMultiplier((QString)siExp);
+ return CNItem::getMultiplier((TQString)siExp);
else
return 1;
@@ -149,12 +149,12 @@ double DoubleSpinBox::getDisplayedNumber( bool * ok )
KLocale * locale = KGlobal::locale();
// Fetch the characters that we don't want to discard
- const QString exclude = locale->decimalSymbol()
+ const TQString exclude = locale->decimalSymbol()
+ locale->thousandsSeparator()
+ locale->positiveSign()
+ locale->negativeSign();
- QString number = cleanText().remove( QRegExp("[^"+exclude+"\\d]") );
+ TQString number = cleanText().remove( TQRegExp("[^"+exclude+"\\d]") );
return locale->readNumber( number, ok );
}
@@ -184,7 +184,7 @@ int DoubleSpinBox::mapTextToValue( bool * ok )
}
-QString DoubleSpinBox::mapValueToText( int v )
+TQString DoubleSpinBox::mapValueToText( int v )
{
double val = double(v)/100.0;