diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-29 16:05:55 +0000 |
commit | 87a016680e3677da3993f333561e79eb0cead7d5 (patch) | |
tree | cbda2b4df8b8ee0d8d1617e6c75bec1e3ee0ccba /src/electronics/components/meter.cpp | |
parent | 6ce3d1ad09c1096b5ed3db334e02859e45d5c32b (diff) | |
download | ktechlab-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/electronics/components/meter.cpp')
-rw-r--r-- | src/electronics/components/meter.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/electronics/components/meter.cpp b/src/electronics/components/meter.cpp index 4437794..fc021a6 100644 --- a/src/electronics/components/meter.cpp +++ b/src/electronics/components/meter.cpp @@ -20,7 +20,7 @@ #include <cmath> #include <klocale.h> -#include <qpainter.h> +#include <tqpainter.h> //BEGIN class Meter @@ -35,7 +35,7 @@ Meter::Meter( ICNDocument *icnDocument, bool newItem, const char *id ) b_firstRun = true; setSize( -16, -16, 32, 32 ); - p_displayText = addDisplayText( "meter", QRect( -16, 16, 32, 16 ), displayText() ); + p_displayText = addDisplayText( "meter", TQRect( -16, 16, 32, 16 ), displayText() ); createProperty( "0-minValue", Variant::Type::Double ); property("0-minValue")->setCaption( i18n("Minimum Value") ); @@ -93,12 +93,12 @@ void Meter::stepNonLogic() } } -void Meter::drawShape( QPainter &p ) +void Meter::drawShape( TQPainter &p ) { initPainter(p); p.drawEllipse( (int)x()-16, (int)y()-16, width(), width() ); - p.setPen(QPen(Qt::black,2)); - p.setBrush(Qt::black); + p.setPen(TQPen(TQt::black,2)); + p.setBrush(TQt::black); // The proportion between 0.1mV and 10KV, on a logarithmic scale double prop; @@ -118,17 +118,17 @@ void Meter::drawShape( QPainter &p ) int cy = int(y()-16+(height()/2)); p.drawLine( int(cx-sin_prop), int(cy-cos_prop), int(cx+sin_prop), int(cy+cos_prop) ); - QPointArray pa(3); - pa[0] = QPoint( int(cx-sin_prop), int(cy-cos_prop) ); // Arrow head - pa[1] = QPoint( int(cx-sin_prop + 8*std::sin(1.571*(-0.3+prop))), int(cy-cos_prop + 8*std::cos(1.571*(-0.3+prop))) ); - pa[2] = QPoint( int(cx-sin_prop + 8*std::sin(1.571*(0.3+prop))), int(cy-cos_prop + 8*std::cos(1.571*(0.3+prop))) ); + TQPointArray pa(3); + pa[0] = TQPoint( int(cx-sin_prop), int(cy-cos_prop) ); // Arrow head + pa[1] = TQPoint( int(cx-sin_prop + 8*std::sin(1.571*(-0.3+prop))), int(cy-cos_prop + 8*std::cos(1.571*(-0.3+prop))) ); + pa[2] = TQPoint( int(cx-sin_prop + 8*std::sin(1.571*(0.3+prop))), int(cy-cos_prop + 8*std::cos(1.571*(0.3+prop))) ); p.drawPolygon(pa); deinitPainter(p); } -QString Meter::displayText() +TQString Meter::displayText() { double value = m_avgValue/m_timeSinceUpdate; if ( !std::isfinite(value) ) value = m_old_value; @@ -137,7 +137,7 @@ QString Meter::displayText() m_avgValue = 0.; m_timeSinceUpdate = 0.; b_timerStarted = false; - return QString::number( value/CNItem::getMultiplier(value), 'g', 3 ) + CNItem::getNumberMag(value) + m_unit; + return TQString::number( value/CNItem::getMultiplier(value), 'g', 3 ) + CNItem::getNumberMag(value) + m_unit; } //END class Meter @@ -151,7 +151,7 @@ Item* FrequencyMeter::construct( ItemDocument *itemDocument, bool newItem, const LibraryItem* FrequencyMeter::libraryItem() { return new LibraryItem( - QString("ec/frequencymeter"), + TQString("ec/frequencymeter"), i18n("Frequency Meter (TODO)"), i18n("Outputs"), "frequencymeter.png", @@ -188,7 +188,7 @@ Item* ECAmmeter::construct( ItemDocument *itemDocument, bool newItem, const char LibraryItem* ECAmmeter::libraryItem() { - QStringList ids; + TQStringList ids; ids << "ec/ammeter" << "ec/ammmeter"; return new LibraryItem( ids, @@ -234,7 +234,7 @@ Item* ECVoltMeter::construct( ItemDocument *itemDocument, bool newItem, const ch LibraryItem* ECVoltMeter::libraryItem() { return new LibraryItem( - QString("ec/voltmeter"), + TQString("ec/voltmeter"), i18n("Voltmeter"), i18n("Outputs"), "voltmeter.png", |