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/kofficeui/KoUnitWidgets.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/kofficeui/KoUnitWidgets.cpp')
-rw-r--r-- | lib/kofficeui/KoUnitWidgets.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/lib/kofficeui/KoUnitWidgets.cpp b/lib/kofficeui/KoUnitWidgets.cpp index 00899882..a9b4fbcf 100644 --- a/lib/kofficeui/KoUnitWidgets.cpp +++ b/lib/kofficeui/KoUnitWidgets.cpp @@ -23,27 +23,27 @@ #include <kdebug.h> #include <kglobal.h> #include <klocale.h> -#include <qpushbutton.h> -#include <qlayout.h> +#include <tqpushbutton.h> +#include <tqlayout.h> // ---------------------------------------------------------------- // Support classes -KoUnitDoubleValidator::KoUnitDoubleValidator( KoUnitDoubleBase *base, QObject *parent, const char *name ) -: KDoubleValidator( parent, name ), m_base( base ) +KoUnitDoubleValidator::KoUnitDoubleValidator( KoUnitDoubleBase *base, TQObject *tqparent, const char *name ) +: KDoubleValidator( tqparent, name ), m_base( base ) { } -QValidator::State -KoUnitDoubleValidator::validate( QString &s, int &pos ) const +TQValidator::State +KoUnitDoubleValidator::validate( TQString &s, int &pos ) const { kdDebug(30004) << "KoUnitDoubleValidator::validate : " << s << " at " << pos << endl; - QValidator::State result = Acceptable; + TQValidator::State result = Acceptable; - QRegExp regexp ("([ a-zA-Z]+)$"); // Letters or spaces at end + TQRegExp regexp ("([ a-zA-Z]+)$"); // Letters or spaces at end const int res = regexp.search( s ); if ( res == -1 ) @@ -53,9 +53,9 @@ KoUnitDoubleValidator::validate( QString &s, int &pos ) const return Intermediate; } - // ### TODO: are all the QString::stripWhiteSpace really necessary? - const QString number ( s.left( res ).stripWhiteSpace() ); - const QString unitName ( regexp.cap( 1 ).stripWhiteSpace().lower() ); + // ### TODO: are all the TQString::stripWhiteSpace really necessary? + const TQString number ( s.left( res ).stripWhiteSpace() ); + const TQString unitName ( regexp.cap( 1 ).stripWhiteSpace().lower() ); kdDebug(30004) << "Split:" << number << ":" << unitName << ":" << endl; @@ -88,25 +88,25 @@ KoUnitDoubleValidator::validate( QString &s, int &pos ) const } -QString KoUnitDoubleBase::getVisibleText( double value ) const +TQString KoUnitDoubleBase::getVisibleText( double value ) const { - const QString num ( QString( "%1%2").arg( KGlobal::locale()->formatNumber( value, m_precision ), KoUnit::unitName( m_unit ) ) ); - kdDebug(30004) << "getVisibleText: " << QString::number( value, 'f', 12 ) << " => " << num << endl; + const TQString num ( TQString( "%1%2").tqarg( KGlobal::locale()->formatNumber( value, m_precision ), KoUnit::unitName( m_unit ) ) ); + kdDebug(30004) << "getVisibleText: " << TQString::number( value, 'f', 12 ) << " => " << num << endl; return num; } -double KoUnitDoubleBase::toDouble( const QString& str, bool* ok ) const +double KoUnitDoubleBase::toDouble( const TQString& str, bool* ok ) const { - QString str2( str ); + TQString str2( str ); /* KLocale::readNumber wants the thousand separator exactly at 1000. But when editing, it might be anywhere. So we need to remove it. */ - const QString sep( KGlobal::locale()->thousandsSeparator() ); + const TQString sep( KGlobal::locale()->thousandsSeparator() ); if ( !sep.isEmpty() ) str2.remove( sep ); str2.remove( KoUnit::unitName( m_unit ) ); const double dbl = KGlobal::locale()->readNumber( str2, ok ); if ( ok ) - kdDebug(30004) << "toDouble:" << str << ": => :" << str2 << ": => " << QString::number( dbl, 'f', 12 ) << endl; + kdDebug(30004) << "toDouble:" << str << ": => :" << str2 << ": => " << TQString::number( dbl, 'f', 12 ) << endl; else kdWarning(30004) << "toDouble error:" << str << ": => :" << str2 << ":" << endl; return dbl; @@ -117,42 +117,42 @@ double KoUnitDoubleBase::toDouble( const QString& str, bool* ok ) const // Widget classes -KoUnitDoubleSpinBox::KoUnitDoubleSpinBox( QWidget *parent, const char *name ) - : KDoubleSpinBox( parent, name ), KoUnitDoubleBase( KoUnit::U_PT, 2 ) +KoUnitDoubleSpinBox::KoUnitDoubleSpinBox( TQWidget *tqparent, const char *name ) + : KDoubleSpinBox( tqparent, name ), KoUnitDoubleBase( KoUnit::U_PT, 2 ) , m_lowerInPoints( -9999 ) , m_upperInPoints( 9999 ) , m_stepInPoints( 1 ) { KDoubleSpinBox::setPrecision( 2 ); - m_validator = new KoUnitDoubleValidator( this, this ); - QSpinBox::setValidator( m_validator ); + m_validator = new KoUnitDoubleValidator( this, TQT_TQOBJECT(this) ); + TQSpinBox::setValidator( m_validator ); setAcceptLocalizedNumbers( true ); setUnit( KoUnit::U_PT ); - connect(this, SIGNAL(valueChanged( double )), SLOT(privateValueChanged())); + connect(this, TQT_SIGNAL(valueChanged( double )), TQT_SLOT(privateValueChanged())); } -KoUnitDoubleSpinBox::KoUnitDoubleSpinBox( QWidget *parent, +KoUnitDoubleSpinBox::KoUnitDoubleSpinBox( TQWidget *tqparent, double lower, double upper, double step, double value, KoUnit::Unit unit, unsigned int precision, const char *name ) - : KDoubleSpinBox( lower, upper, step, value, precision, parent, name ), + : KDoubleSpinBox( lower, upper, step, value, precision, tqparent, name ), KoUnitDoubleBase( unit, precision ), m_lowerInPoints( lower ), m_upperInPoints( upper ), m_stepInPoints( step ) { m_unit = KoUnit::U_PT; - m_validator = new KoUnitDoubleValidator( this, this ); - QSpinBox::setValidator( m_validator ); + m_validator = new KoUnitDoubleValidator( this, TQT_TQOBJECT(this) ); + TQSpinBox::setValidator( m_validator ); setAcceptLocalizedNumbers( true ); setUnit( unit ); changeValue( value ); setLineStep( 0.5 ); - connect(this, SIGNAL(valueChanged( double )), SLOT(privateValueChanged())); + connect(this, TQT_SIGNAL(valueChanged( double )), TQT_SLOT(privateValueChanged())); } void @@ -219,24 +219,24 @@ void KoUnitDoubleSpinBox::setMinMaxStep( double min, double max, double step ) // ---------------------------------------------------------------- -KoUnitDoubleLineEdit::KoUnitDoubleLineEdit( QWidget *parent, const char *name ) - : KLineEdit( parent, name ), KoUnitDoubleBase( KoUnit::U_PT, 2 ), m_value( 0.0 ), m_lower( 0.0 ), m_upper( 9999.99 ), +KoUnitDoubleLineEdit::KoUnitDoubleLineEdit( TQWidget *tqparent, const char *name ) + : KLineEdit( tqparent, name ), KoUnitDoubleBase( KoUnit::U_PT, 2 ), m_value( 0.0 ), m_lower( 0.0 ), m_upper( 9999.99 ), m_lowerInPoints( 0.0 ), m_upperInPoints( 9999.99 ) { - setAlignment( Qt::AlignRight ); - m_validator = new KoUnitDoubleValidator( this, this ); + tqsetAlignment( TQt::AlignRight ); + m_validator = new KoUnitDoubleValidator( this, TQT_TQOBJECT(this) ); setValidator( m_validator ); setUnit( KoUnit::U_PT ); changeValue( KoUnit::ptToUnit( 0.0, KoUnit::U_PT ) ); } -KoUnitDoubleLineEdit::KoUnitDoubleLineEdit( QWidget *parent, double lower, double upper, double value, KoUnit::Unit unit, +KoUnitDoubleLineEdit::KoUnitDoubleLineEdit( TQWidget *tqparent, double lower, double upper, double value, KoUnit::Unit unit, unsigned int precision, const char *name ) - : KLineEdit( parent, name ), KoUnitDoubleBase( unit, precision ), m_value( value ), m_lower( lower ), m_upper( upper ), + : KLineEdit( tqparent, name ), KoUnitDoubleBase( unit, precision ), m_value( value ), m_lower( lower ), m_upper( upper ), m_lowerInPoints( lower ), m_upperInPoints( upper ) { - setAlignment( Qt::AlignRight ); - m_validator = new KoUnitDoubleValidator( this, this ); + tqsetAlignment( TQt::AlignRight ); + m_validator = new KoUnitDoubleValidator( this, TQT_TQOBJECT(this) ); setValidator( m_validator ); setUnit( unit ); changeValue( KoUnit::ptToUnit( value, unit ) ); @@ -260,10 +260,10 @@ KoUnitDoubleLineEdit::setUnit( KoUnit::Unit unit ) } bool -KoUnitDoubleLineEdit::eventFilter( QObject* o, QEvent* ev ) +KoUnitDoubleLineEdit::eventFilter( TQObject* o, TQEvent* ev ) { #if 0 - if( ev->type() == QEvent::FocusOut || ev->type() == QEvent::Leave || ev->type() == QEvent::Hide ) + if( ev->type() == TQEvent::FocusOut || ev->type() == TQEvent::Leave || ev->type() == TQEvent::Hide ) { bool ok; double value = toDouble( text(), &ok ); @@ -272,7 +272,7 @@ KoUnitDoubleLineEdit::eventFilter( QObject* o, QEvent* ev ) } else #endif - return QLineEdit::eventFilter( o, ev ); + return TQLineEdit::eventFilter( o, ev ); } double KoUnitDoubleLineEdit::value( void ) const @@ -284,34 +284,34 @@ double KoUnitDoubleLineEdit::value( void ) const // ---------------------------------------------------------------- -KoUnitDoubleComboBox::KoUnitDoubleComboBox( QWidget *parent, const char *name ) - : KComboBox( true, parent, name ), KoUnitDoubleBase( KoUnit::U_PT, 2 ), m_value( 0.0 ), m_lower( 0.0 ), m_upper( 9999.99 ), m_lowerInPoints( 0.0 ), m_upperInPoints( 9999.99 ) +KoUnitDoubleComboBox::KoUnitDoubleComboBox( TQWidget *tqparent, const char *name ) + : KComboBox( true, tqparent, name ), KoUnitDoubleBase( KoUnit::U_PT, 2 ), m_value( 0.0 ), m_lower( 0.0 ), m_upper( 9999.99 ), m_lowerInPoints( 0.0 ), m_upperInPoints( 9999.99 ) { - lineEdit()->setAlignment( Qt::AlignRight ); - m_validator = new KoUnitDoubleValidator( this, this ); + lineEdit()->tqsetAlignment( TQt::AlignRight ); + m_validator = new KoUnitDoubleValidator( this, TQT_TQOBJECT(this) ); lineEdit()->setValidator( m_validator ); setUnit( KoUnit::U_PT ); changeValue( KoUnit::ptToUnit( 0.0, KoUnit::U_PT ) ); - connect( this, SIGNAL( activated( int ) ), this, SLOT( slotActivated( int ) ) ); + connect( this, TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( slotActivated( int ) ) ); } -KoUnitDoubleComboBox::KoUnitDoubleComboBox( QWidget *parent, double lower, double upper, double value, KoUnit::Unit unit, +KoUnitDoubleComboBox::KoUnitDoubleComboBox( TQWidget *tqparent, double lower, double upper, double value, KoUnit::Unit unit, unsigned int precision, const char *name ) - : KComboBox( true, parent, name ), KoUnitDoubleBase( unit, precision ), m_value( value ), m_lower( lower ), m_upper( upper ), + : KComboBox( true, tqparent, name ), KoUnitDoubleBase( unit, precision ), m_value( value ), m_lower( lower ), m_upper( upper ), m_lowerInPoints( lower ), m_upperInPoints( upper ) { - lineEdit()->setAlignment( Qt::AlignRight ); - m_validator = new KoUnitDoubleValidator( this, this ); + lineEdit()->tqsetAlignment( TQt::AlignRight ); + m_validator = new KoUnitDoubleValidator( this, TQT_TQOBJECT(this) ); lineEdit()->setValidator( m_validator ); setUnit( unit ); changeValue( KoUnit::ptToUnit( value, unit ) ); - connect( this, SIGNAL( activated( int ) ), this, SLOT( slotActivated( int ) ) ); + connect( this, TQT_SIGNAL( activated( int ) ), this, TQT_SLOT( slotActivated( int ) ) ); } void KoUnitDoubleComboBox::changeValue( double value ) { - QString oldLabel = lineEdit()->text(); + TQString oldLabel = lineEdit()->text(); updateValue( value ); if( lineEdit()->text() != oldLabel ) emit valueChanged( m_value ); @@ -352,10 +352,10 @@ KoUnitDoubleComboBox::setUnit( KoUnit::Unit unit ) } bool -KoUnitDoubleComboBox::eventFilter( QObject* o, QEvent* ev ) +KoUnitDoubleComboBox::eventFilter( TQObject* o, TQEvent* ev ) { #if 0 - if( ev->type() == QEvent::FocusOut || ev->type() == QEvent::Leave || ev->type() == QEvent::Hide ) + if( ev->type() == TQEvent::FocusOut || ev->type() == TQEvent::Leave || ev->type() == TQEvent::Hide ) { bool ok; double value = toDouble( lineEdit()->text(), &ok ); @@ -364,7 +364,7 @@ KoUnitDoubleComboBox::eventFilter( QObject* o, QEvent* ev ) } else #endif - return QComboBox::eventFilter( o, ev ); + return TQComboBox::eventFilter( o, ev ); } double KoUnitDoubleComboBox::value( void ) const @@ -376,51 +376,51 @@ double KoUnitDoubleComboBox::value( void ) const // ---------------------------------------------------------------- -KoUnitDoubleSpinComboBox::KoUnitDoubleSpinComboBox( QWidget *parent, const char *name ) - : QWidget( parent ), m_step( 1.0 ) +KoUnitDoubleSpinComboBox::KoUnitDoubleSpinComboBox( TQWidget *tqparent, const char *name ) + : TQWidget( tqparent ), m_step( 1.0 ) { - QGridLayout *layout = new QGridLayout( this, 2, 3 ); - //layout->setMargin( 2 ); - QPushButton *up = new QPushButton( "+", this ); + TQGridLayout *tqlayout = new TQGridLayout( this, 2, 3 ); + //tqlayout->setMargin( 2 ); + TQPushButton *up = new TQPushButton( "+", this ); //up->setFlat( true ); up->setMaximumHeight( 15 ); up->setMaximumWidth( 15 ); - layout->addWidget( up, 0, 0 ); - connect( up, SIGNAL( clicked() ), this, SLOT( slotUpClicked() ) ); + tqlayout->addWidget( up, 0, 0 ); + connect( up, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotUpClicked() ) ); - QPushButton *down = new QPushButton( "-", this ); + TQPushButton *down = new TQPushButton( "-", this ); down->setMaximumHeight( 15 ); down->setMaximumWidth( 15 ); - layout->addWidget( down, 1, 0 ); - connect( down, SIGNAL( clicked() ), this, SLOT( slotDownClicked() ) ); + tqlayout->addWidget( down, 1, 0 ); + connect( down, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotDownClicked() ) ); m_combo = new KoUnitDoubleComboBox( this, KoUnit::ptToUnit( 0.0, KoUnit::U_PT ), KoUnit::ptToUnit( 9999.99, KoUnit::U_PT ), 0.0, KoUnit::U_PT, 2, name ); - connect( m_combo, SIGNAL( valueChanged( double ) ), this, SIGNAL( valueChanged( double ) ) ); - layout->addMultiCellWidget( m_combo, 0, 1, 2, 2 ); + connect( m_combo, TQT_SIGNAL( valueChanged( double ) ), this, TQT_SIGNAL( valueChanged( double ) ) ); + tqlayout->addMultiCellWidget( m_combo, 0, 1, 2, 2 ); } -KoUnitDoubleSpinComboBox::KoUnitDoubleSpinComboBox( QWidget *parent, double lower, double upper, double step, double value, +KoUnitDoubleSpinComboBox::KoUnitDoubleSpinComboBox( TQWidget *tqparent, double lower, double upper, double step, double value, KoUnit::Unit unit, unsigned int precision, const char *name ) - : QWidget( parent ), m_step( step )//, m_lowerInPoints( lower ), m_upperInPoints( upper ) + : TQWidget( tqparent ), m_step( step )//, m_lowerInPoints( lower ), m_upperInPoints( upper ) { - QGridLayout *layout = new QGridLayout( this, 2, 3 ); - //layout->setMargin( 2 ); - QPushButton *up = new QPushButton( "+", this ); + TQGridLayout *tqlayout = new TQGridLayout( this, 2, 3 ); + //tqlayout->setMargin( 2 ); + TQPushButton *up = new TQPushButton( "+", this ); //up->setFlat( true ); up->setMaximumHeight( 15 ); up->setMaximumWidth( 15 ); - layout->addWidget( up, 0, 0 ); - connect( up, SIGNAL( clicked() ), this, SLOT( slotUpClicked() ) ); + tqlayout->addWidget( up, 0, 0 ); + connect( up, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotUpClicked() ) ); - QPushButton *down = new QPushButton( "-", this ); + TQPushButton *down = new TQPushButton( "-", this ); down->setMaximumHeight( 15 ); down->setMaximumWidth( 15 ); - layout->addWidget( down, 1, 0 ); - connect( down, SIGNAL( clicked() ), this, SLOT( slotDownClicked() ) ); + tqlayout->addWidget( down, 1, 0 ); + connect( down, TQT_SIGNAL( clicked() ), this, TQT_SLOT( slotDownClicked() ) ); m_combo = new KoUnitDoubleComboBox( this, KoUnit::ptToUnit( lower, unit ), KoUnit::ptToUnit( upper, unit ), value, unit, precision, name ); - connect( m_combo, SIGNAL( valueChanged( double ) ), this, SIGNAL( valueChanged( double ) ) ); - layout->addMultiCellWidget( m_combo, 0, 1, 2, 2 ); + connect( m_combo, TQT_SIGNAL( valueChanged( double ) ), this, TQT_SIGNAL( valueChanged( double ) ) ); + tqlayout->addMultiCellWidget( m_combo, 0, 1, 2, 2 ); } void |