From a0d24dbcfc9eb4f6caa6dc96f345183e3851f7af Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 16 Jul 2012 14:58:20 -0500 Subject: Fix flickering --- clients/tde/src/part/commanalyzer/part.cpp | 4 +-- clients/tde/src/part/scope/part.cpp | 8 ++--- clients/tde/src/widgets/tracewidget.cpp | 50 ++++++++++++++++-------------- 3 files changed, 33 insertions(+), 29 deletions(-) (limited to 'clients/tde') diff --git a/clients/tde/src/part/commanalyzer/part.cpp b/clients/tde/src/part/commanalyzer/part.cpp index 6042829..2e86b92 100644 --- a/clients/tde/src/part/commanalyzer/part.cpp +++ b/clients/tde/src/part/commanalyzer/part.cpp @@ -585,8 +585,8 @@ void CommAnalyzerPart::mainEventLoop() { m_traceWidget->setSamples(0, trace); m_base->traceZoomWidget->setSamples(0, trace); postProcessTrace(); - m_traceWidget->repaint(true); - m_base->traceZoomWidget->repaint(true); + m_traceWidget->repaint(false); + m_base->traceZoomWidget->repaint(false); } diff --git a/clients/tde/src/part/scope/part.cpp b/clients/tde/src/part/scope/part.cpp index 50ce4a3..75bf488 100644 --- a/clients/tde/src/part/scope/part.cpp +++ b/clients/tde/src/part/scope/part.cpp @@ -680,8 +680,8 @@ void ScopePart::mainEventLoop() { m_base->traceZoomWidget->setSamples(m_currentOpChannel-1, trace); m_base->traceZoomWidget->setPositions(m_currentOpChannel-1, positions); postProcessTrace(); - m_traceWidget->repaint(true); - m_base->traceZoomWidget->repaint(true); + m_traceWidget->repaint(false); + m_base->traceZoomWidget->repaint(false); } if (result == "ACK") { @@ -857,8 +857,8 @@ void ScopePart::recallWaveforms() { // HACK // Force resize of parent frame emit(resizeToHintRequested()); - m_traceWidget->repaint(true); - m_base->traceZoomWidget->repaint(true); + m_traceWidget->repaint(false); + m_base->traceZoomWidget->repaint(false); } else { KMessageBox::error(0, i18n("The selected waveform file version does not match this client"), i18n("Invalid File")); diff --git a/clients/tde/src/widgets/tracewidget.cpp b/clients/tde/src/widgets/tracewidget.cpp index 115169b..1f7c576 100644 --- a/clients/tde/src/widgets/tracewidget.cpp +++ b/clients/tde/src/widgets/tracewidget.cpp @@ -206,7 +206,7 @@ void TraceData::movePosOneTick() { emit(offsetChanged(offset)); parentWidget->updateTraceText(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } void TraceData::moveNegOneTick() { @@ -216,7 +216,7 @@ void TraceData::moveNegOneTick() { emit(offsetChanged(offset)); parentWidget->updateTraceText(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } void TraceData::resetVPosition() { @@ -224,7 +224,7 @@ void TraceData::resetVPosition() { emit(offsetChanged(offset)); parentWidget->updateTraceText(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } CursorData::CursorData(TraceWidget* parent, TQWidget* labelParent) : TQObject(), parentWidget(parent) { @@ -330,7 +330,7 @@ void CursorData::movePosOneTick() { parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->updateGraticule(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } void CursorData::moveNegOneTick() { @@ -352,7 +352,7 @@ void CursorData::moveNegOneTick() { parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->updateGraticule(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } void CursorData::movePosMultiTicks() { @@ -374,7 +374,7 @@ void CursorData::movePosMultiTicks() { parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->updateGraticule(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } void CursorData::moveNegMultiTicks() { @@ -396,7 +396,7 @@ void CursorData::moveNegMultiTicks() { parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->updateGraticule(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } bool CursorData::eventFilter(TQObject *o, TQEvent *e) { @@ -406,13 +406,13 @@ bool CursorData::eventFilter(TQObject *o, TQEvent *e) { highlighted = true; parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->updateGraticule(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } if (e->type() == TQEvent::Leave) { highlighted = false; parentWidget->updateCursorText(); parentWidget->m_graticuleWidget->updateGraticule(); - parentWidget->m_graticuleWidget->repaint(true); + parentWidget->m_graticuleWidget->repaint(false); } } // Allow event processing by other routines @@ -481,12 +481,13 @@ void GraticuleWidget::updateGraticule() { } // Repaint the widget - repaint(); + repaint(false); } void GraticuleWidget::paintEvent(TQPaintEvent*) { - TQPainter p(this); - + // Paint onto background pixmap before painting to window to reduce flickering + TQPixmap updatePixmap(width(), height()); + TQPainter p(&updatePixmap); if (m_graticulePixmap) { // Draw the graticule pixmap to erase the widget p.drawPixmap(0, 0, *m_graticulePixmap); @@ -504,6 +505,9 @@ void GraticuleWidget::paintEvent(TQPaintEvent*) { else { p.fillRect(x(), y(), width(), height(), backgroundColor()); } + p.end(); + // Paint to window + bitBlt(this, 0, 0, &updatePixmap, 0, 0, updatePixmap.width(), updatePixmap.height(), TQt::CopyROP); } void GraticuleWidget::resizeEvent(TQResizeEvent *) { @@ -585,7 +589,7 @@ void GraticuleWidget::mouseReleaseEvent(TQMouseEvent *e) { } updateGraticule(); - repaint(true); + repaint(false); } void GraticuleWidget::mouseDoubleClickEvent(TQMouseEvent *) { @@ -704,7 +708,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) { m_base->m_cursorArray[m_movingCursor]->position = 100.0; } updateGraticule(); - repaint(true); + repaint(false); cursorHighlightChanged = false; } else if (m_middleMouseDown) { @@ -716,7 +720,7 @@ void GraticuleWidget::mouseMoveEvent(TQMouseEvent *e) { m_base->updateCursorText(); if (cursorHighlightChanged) { updateGraticule(); - repaint(true); + repaint(false); } } @@ -829,7 +833,7 @@ void TraceWidget::setDisplayLimits(uint traceNumber, TQRectF limits) { m_traceArray[traceNumber]->bottomEdge = limits.height(); m_graticuleWidget->updateGraticule(); - m_graticuleWidget->repaint(true); + m_graticuleWidget->repaint(false); updateTraceText(); updateCursorText(); } @@ -940,7 +944,7 @@ void TraceWidget::setSamples(uint traceNumber, TQDoubleArray& tqda) { m_traceArray[traceNumber]->sampleArray = tqda; m_traceArray[traceNumber]->numberOfSamples = tqda.size(); - m_graticuleWidget->repaint(true); + m_graticuleWidget->repaint(false); } TQDoubleArray& TraceWidget::positions(uint traceNumber) { @@ -955,7 +959,7 @@ void TraceWidget::setPositions(uint traceNumber, TQDoubleArray& tqda) { m_traceArray[traceNumber]->positionArray = tqda; m_traceArray[traceNumber]->numberOfSamples = tqda.size(); - m_graticuleWidget->repaint(true); + m_graticuleWidget->repaint(false); } TQColor TraceWidget::traceColor(uint traceNumber) { @@ -970,7 +974,7 @@ void TraceWidget::setTraceColor(uint traceNumber, TQColor color) { m_traceArray[traceNumber]->color = color; m_graticuleWidget->updateGraticule(); - m_graticuleWidget->repaint(true); + m_graticuleWidget->repaint(false); updateTraceText(); } @@ -1003,7 +1007,7 @@ void TraceWidget::setTraceEnabled(uint traceNumber, bool enabled, bool showText) } m_graticuleWidget->updateGraticule(); - m_graticuleWidget->repaint(true); + m_graticuleWidget->repaint(false); updateTraceText(); } @@ -1061,7 +1065,7 @@ void TraceWidget::setCursorPosition(uint cursorNumber, double position) { m_cursorArray[cursorNumber]->position = position; updateCursorText(); m_graticuleWidget->updateGraticule(); - m_graticuleWidget->repaint(true); + m_graticuleWidget->repaint(false); } bool TraceWidget::cursorEnabled(uint cursorNumber) { @@ -1287,7 +1291,7 @@ void TraceWidget::setZoomCursorBox(const TQRectF rect) { updateCursorText(); m_graticuleWidget->updateGraticule(); - m_graticuleWidget->repaint(true); + m_graticuleWidget->repaint(false); return; } @@ -1369,7 +1373,7 @@ void TraceWidget::setTraceOffset(uint traceNumber, double offset) { m_traceArray[traceNumber]->offset = offset; - m_graticuleWidget->repaint(true); + m_graticuleWidget->repaint(false); updateTraceText(); } -- cgit v1.2.1