summaryrefslogtreecommitdiffstats
path: root/src/gui/oscilloscopeview.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/oscilloscopeview.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/oscilloscopeview.cpp')
-rw-r--r--src/gui/oscilloscopeview.cpp78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/gui/oscilloscopeview.cpp b/src/gui/oscilloscopeview.cpp
index 3d2a40a..aa05311 100644
--- a/src/gui/oscilloscopeview.cpp
+++ b/src/gui/oscilloscopeview.cpp
@@ -19,14 +19,14 @@
#include <klocale.h>
#include <kglobal.h>
#include <kpopupmenu.h>
-#include <qcheckbox.h>
-#include <qcursor.h>
-#include <qevent.h>
-#include <qlabel.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qscrollbar.h>
-#include <qtimer.h>
+#include <tqcheckbox.h>
+#include <tqcursor.h>
+#include <tqevent.h>
+#include <tqlabel.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqscrollbar.h>
+#include <tqtimer.h>
#include <algorithm>
#include <cmath>
@@ -37,8 +37,8 @@ inline ullong min( ullong a, ullong b )
}
-OscilloscopeView::OscilloscopeView( QWidget *parent, const char *name )
- : QFrame( parent, name, WNoAutoErase ),
+OscilloscopeView::OscilloscopeView( TQWidget *tqparent, const char *name )
+ : TQFrame( tqparent, name, WNoAutoErase ),
b_needRedraw(true),
m_pixmap(0l),
m_fps(10),
@@ -53,8 +53,8 @@ OscilloscopeView::OscilloscopeView( QWidget *parent, const char *name )
setBackgroundMode(NoBackground);
setMouseTracking(true);
- m_updateViewTmr = new QTimer(this);
- connect( m_updateViewTmr, SIGNAL(timeout()), this, SLOT(updateViewTimeout()) );
+ m_updateViewTmr = new TQTimer(this);
+ connect( m_updateViewTmr, TQT_SIGNAL(timeout()), this, TQT_SLOT(updateViewTimeout()) );
}
@@ -77,7 +77,7 @@ void OscilloscopeView::updateView()
void OscilloscopeView::updateViewTimeout()
{
b_needRedraw = true;
- repaint(false);
+ tqrepaint(false);
updateTimeLabel();
}
@@ -86,26 +86,26 @@ void OscilloscopeView::updateTimeLabel()
{
if ( hasMouse() )
{
- int x = mapFromGlobal( QCursor::pos() ).x();
+ int x = mapFromGlobal( TQCursor::pos() ).x();
double time = (double(Oscilloscope::self()->scrollTime()) / LOGIC_UPDATE_RATE) + (x / Oscilloscope::self()->pixelsPerSecond());
- Oscilloscope::self()->timeLabel->setText( QString::number( time, 'f', 6 ) );
+ Oscilloscope::self()->timeLabel->setText( TQString::number( time, 'f', 6 ) );
}
else
- Oscilloscope::self()->timeLabel->setText( QString::null );
+ Oscilloscope::self()->timeLabel->setText( TQString() );
}
-void OscilloscopeView::resizeEvent( QResizeEvent *e )
+void OscilloscopeView::resizeEvent( TQResizeEvent *e )
{
delete m_pixmap;
- m_pixmap = new QPixmap( e->size() );
+ m_pixmap = new TQPixmap( e->size() );
b_needRedraw = true;
- QFrame::resizeEvent(e);
+ TQFrame::resizeEvent(e);
}
-void OscilloscopeView::mousePressEvent( QMouseEvent *event )
+void OscilloscopeView::mousePressEvent( TQMouseEvent *event )
{
switch ( event->button() )
{
@@ -114,7 +114,7 @@ void OscilloscopeView::mousePressEvent( QMouseEvent *event )
event->accept();
m_clickOffsetPos = event->pos().x();
m_sliderValueAtClick = Oscilloscope::self()->horizontalScroll->value();
- setCursor( Qt::SizeAllCursor );
+ setCursor( TQt::SizeAllCursor );
return;
}
@@ -130,25 +130,25 @@ void OscilloscopeView::mousePressEvent( QMouseEvent *event )
for ( uint i=0; i<5; ++i )
{
const int num = fps[i];
- fpsMenu.insertItem( i18n("%1 fps").arg(num), num );
+ fpsMenu.insertItem( i18n("%1 fps").tqarg(num), num );
fpsMenu.setItemChecked( num, num == m_fps );
}
- connect( &fpsMenu, SIGNAL(activated(int )), this, SLOT(slotSetFrameRate(int )) );
+ connect( &fpsMenu, TQT_SIGNAL(activated(int )), this, TQT_SLOT(slotSetFrameRate(int )) );
fpsMenu.exec( event->globalPos() );
return;
}
default:
{
- QFrame::mousePressEvent(event);
+ TQFrame::mousePressEvent(event);
return;
}
}
}
-void OscilloscopeView::mouseMoveEvent( QMouseEvent *event )
+void OscilloscopeView::mouseMoveEvent( TQMouseEvent *event )
{
event->accept();
updateTimeLabel();
@@ -162,14 +162,14 @@ void OscilloscopeView::mouseMoveEvent( QMouseEvent *event )
}
-void OscilloscopeView::mouseReleaseEvent( QMouseEvent *event )
+void OscilloscopeView::mouseReleaseEvent( TQMouseEvent *event )
{
if ( m_sliderValueAtClick == -1 )
- return QFrame::mouseReleaseEvent(event);
+ return TQFrame::mouseReleaseEvent(event);
event->accept();
m_sliderValueAtClick = -1;
- setCursor( Qt::ArrowCursor );
+ setCursor( TQt::ArrowCursor );
}
@@ -188,16 +188,16 @@ static double lld_modulus( llong a, double b )
}
-void OscilloscopeView::paintEvent( QPaintEvent *e )
+void OscilloscopeView::paintEvent( TQPaintEvent *e )
{
- QRect r = e->rect();
+ TQRect r = e->rect();
if (b_needRedraw)
{
updateOutputHeight();
const double pixelsPerSecond = Oscilloscope::self()->pixelsPerSecond();
- QPainter p;
+ TQPainter p;
m_pixmap->fill( paletteBackgroundColor() );
p.begin(m_pixmap);
p.setClipRegion(e->region());
@@ -213,7 +213,7 @@ void OscilloscopeView::paintEvent( QPaintEvent *e )
double linesOffset = - lld_modulus( pixelsOffset, spacing );
int blackness = 256 - int(184.0 * spacing / (min_sep*divisions*divisions));
- p.setPen( QColor( blackness, blackness, blackness ) );
+ p.setPen( TQColor( blackness, blackness, blackness ) );
for ( double i = linesOffset; i <= frameRect().width(); i += spacing )
p.drawLine( int(i), 1, int(i), frameRect().height()-2 );
@@ -224,7 +224,7 @@ void OscilloscopeView::paintEvent( QPaintEvent *e )
linesOffset = - lld_modulus( pixelsOffset, spacing );
blackness = 256 - int(184.0 * spacing / (min_sep*divisions*divisions));
- p.setPen( QColor( blackness, blackness, blackness ) );
+ p.setPen( TQColor( blackness, blackness, blackness ) );
for ( double i = linesOffset; i <= frameRect().width(); i += spacing )
p.drawLine( int(i), 1, int(i), frameRect().height()-2 );
@@ -235,7 +235,7 @@ void OscilloscopeView::paintEvent( QPaintEvent *e )
linesOffset = - lld_modulus( pixelsOffset, spacing );
blackness = 256 - int(184.0);
- p.setPen( QColor( blackness, blackness, blackness ) );
+ p.setPen( TQColor( blackness, blackness, blackness ) );
for ( double i = linesOffset; i <= frameRect().width(); i += spacing )
p.drawLine( int(i), 1, int(i), frameRect().height()-2 );
@@ -244,7 +244,7 @@ void OscilloscopeView::paintEvent( QPaintEvent *e )
drawLogicData(p);
drawFloatingData(p);
- p.setPen(Qt::black);
+ p.setPen(TQt::black);
p.drawRect( frameRect() );
b_needRedraw = false;
@@ -260,7 +260,7 @@ void OscilloscopeView::updateOutputHeight()
}
-void OscilloscopeView::drawLogicData( QPainter & p )
+void OscilloscopeView::drawLogicData( TQPainter & p )
{
const double pixelsPerSecond = Oscilloscope::self()->pixelsPerSecond();
@@ -286,7 +286,7 @@ void OscilloscopeView::drawLogicData( QPainter & p )
const llong timeOffset = Oscilloscope::self()->scrollTime();
// Draw the horizontal line indicating the midpoint of our output
- p.setPen( QColor( 228, 228, 228 ) );
+ p.setPen( TQColor( 228, 228, 228 ) );
p.drawLine( 0, midHeight, width(), midHeight );
// Set the pen colour according to the colour the user has selected for the probe
@@ -365,7 +365,7 @@ void OscilloscopeView::drawLogicData( QPainter & p )
#define v_to_y int(midHeight - (logarithmic ? ( (v>0) ? log(v/lowerAbsValue) : -log(-v/lowerAbsValue) ) : v) * sf)
-void OscilloscopeView::drawFloatingData( QPainter & p )
+void OscilloscopeView::drawFloatingData( TQPainter & p )
{
const double pixelsPerSecond = Oscilloscope::self()->pixelsPerSecond();
@@ -386,7 +386,7 @@ void OscilloscopeView::drawFloatingData( QPainter & p )
const llong timeOffset = Oscilloscope::self()->scrollTime();
// Draw the horizontal line indicating the midpoint of our output
- p.setPen( QColor( 228, 228, 228 ) );
+ p.setPen( TQColor( 228, 228, 228 ) );
p.drawLine( 0, midHeight, width(), midHeight );
// Set the pen colour according to the colour the user has selected for the probe