/** Overloads default QWidget::paintEvent. Draws the actual * bandwidth graph. */ void GraphFrame::paintEvent(QPaintEvent *event) { Q_UNUSED(event); /* Set current graph dimensions */ _rec = this->frameRect(); /* Start the painter */ _painter->begin(this); /* We want antialiased lines and text */ _painter->setRenderHint(QPainter::Antialiasing); _painter->setRenderHint(QPainter::TextAntialiasing); /* Fill in the background */ _painter->fillRect(_rec, QBrush(BACK_COLOR)); _painter->drawRect(_rec); /* Paint the scale */ paintScale(); /* Plot the send/receive data */ paintData(); /* Paint the send/recv totals */ paintTotals(); /* Stop the painter */ _painter->end(); }
// Paint event handler. void qtractorMeterScale::paintEvent ( QPaintEvent * ) { QPainter painter(this); m_iLastY = 0; #ifndef CONFIG_GRADIENT painter.setPen(Qt::darkGray); #endif paintScale(&painter); }
void TGLFunWidget::displayObject(void) { if (mesh->getFEType() == NOTYPE) return; if (!xList1) createFunObject(); glCallList(xList1); if (params.isValueScale) paintScale(); if (params.isCoord) drawCoordinateCross(); }
void UIFrameBufferQImage::paintEvent(QPaintEvent *pEvent) { /* On mode switch the enqueued paint event may still come * while the view is already null (before the new view gets set), * ignore paint event in that case. */ if (!m_pMachineView) return; /* If the machine is NOT in 'running', 'paused' or 'saving' state, * the link between the framebuffer and the video memory is broken. * We should go fallback in that case. * We should acquire actual machine-state to exclude * situations when the state was changed already but * GUI didn't received event about that or didn't processed it yet. */ KMachineState machineState = m_pMachineView->uisession()->session().GetConsole().GetState(); if ( m_bUsesGuestVRAM /* running */ && machineState != KMachineState_Running && machineState != KMachineState_Teleporting && machineState != KMachineState_LiveSnapshotting /* paused */ && machineState != KMachineState_Paused && machineState != KMachineState_TeleportingPausedVM /* saving */ && machineState != KMachineState_Saving /* guru */ && machineState != KMachineState_Stuck ) { LogRelFlow(("UIFrameBufferQImage::paintEvent: " "Going fallback due to machine-state become invalid: " "%d.\n", (int)machineState)); goFallback(); } /* Depending on visual-state type: */ switch (m_pMachineView->machineLogic()->visualStateType()) { case UIVisualStateType_Seamless: paintSeamless(pEvent); break; case UIVisualStateType_Scale: paintScale(pEvent); break; default: paintDefault(pEvent); break; } }
void Legend::paintLegend(SkyQPainter *painter) { if(!m_DeletePainter) { m_Painter = painter; } if(m_Position != LP_FLOATING) { m_PositionFloating = positionToDeviceCoord(painter->device()); } m_Painter->translate(m_PositionFloating.x(), m_PositionFloating.y()); m_Painter->setFont(m_Font); QBrush backgroundBrush(m_BgColor, Qt::SolidPattern); QPen backgroundPen(m_cScheme->colorNamed("SNameColor")); backgroundPen.setStyle(Qt::SolidLine); // set brush & pen m_Painter->setBrush(backgroundBrush); m_Painter->setPen(backgroundPen); QSize size = calculateSize(); if(m_DrawFrame) { m_Painter->drawRect(1, 1, size.width(), size.height()); } else { QPen noLinePen; noLinePen.setStyle(Qt::NoPen); m_Painter->setPen(noLinePen); m_Painter->drawRect(1, 1, size.width(), size.height()); m_Painter->setPen(backgroundPen); } switch(m_Orientation) { case LO_HORIZONTAL: { switch(m_Type) { case LT_SCALE_ONLY: { paintScale(QPointF(20, 20)); break; } case LT_MAGNITUDES_ONLY: { paintMagnitudes(QPointF(20, 20)); break; } case LT_SYMBOLS_ONLY: { paintSymbols(QPointF(20, 20)); break; } case LT_SCALE_MAGNITUDES: { paintMagnitudes(QPointF(20, 20)); paintScale(QPointF(150, 20)); break; } case LT_FULL: { paintSymbols(QPointF(20, 20)); paintMagnitudes(QPointF(10, 40 + m_SymbolSize + m_BRectHeight)); paintScale(QPointF(200, 40 + m_SymbolSize + m_BRectHeight)); break; } default: break; // should never happen } break; } case LO_VERTICAL: { switch(m_Type) { case LT_SCALE_ONLY: { paintScale(QPointF(20, 20)); break; } case LT_MAGNITUDES_ONLY: { paintMagnitudes(QPointF(20, 20)); break; } case LT_SYMBOLS_ONLY: { paintSymbols(QPointF(20, 20)); break; } case LT_SCALE_MAGNITUDES: { paintMagnitudes(QPointF(7, 20)); paintScale(QPointF(20, 80)); break; } case LT_FULL: { paintSymbols(QPointF(30, 20)); paintMagnitudes(QPointF(7, 30 + 7 * m_YSymbolSpacing)); paintScale(QPointF(20, 90 + 7 * m_YSymbolSpacing)); break; } default: break; // should never happen } break; } default: break; // should never happen } }