void Graph::DrawXAxis(QSGNode * rootNode) {
    QRectF bounds = boundingRect();
    // X AXIS FEATURES
    for (QList<float>::iterator i = xAxis.major.begin(); i != xAxis.major.end(); i++) {
        float x = graphToNodeX(*i);
        float y = boundingRect().height() + xLabelOffset;

        _drawLine(rootNode, m_primaryLineColor, x, bounds.top(), x, bounds.bottom(), 2);
        _drawLabel(x, y, QString::number(*i), xAxisLabels);
    }

    for (QList<float>::iterator i = xAxis.minor.begin(); i != xAxis.minor.end(); i++) {
        float x = graphToNodeX(*i);
        float y = boundingRect().height() + xLabelOffset;

        _drawLine(rootNode, m_primaryLineColor.darker(),x, bounds.top(), x, bounds.bottom(), -1);
        _drawLabel(x, y, QString::number(*i), xAxisLabels);
    }

    for (QList<float>::iterator i = xAxis.subminor.begin(); i != xAxis.subminor.end(); i++) {
        float x = graphToNodeX(*i);
        float y = boundingRect().height() + xLabelOffset;

        _drawLine(rootNode, m_primaryLineColor.darker(), x, bounds.bottom(), x, bounds.top(), 0.5);
        _drawLabel(x, y, QString::number(*i), xAxisLabels);
    }

    // We can draw ticks, but the PPA prototype didn't have any
    /*for (QList<float>::iterator i = xAxis.tick.begin(); i != xAxis.tick.end(); i++) {
        float x = graphToNodeX(*i);

        _drawLine(rootNode, QColor(255, 255, 255, 255), x, bounds.bottom(), x, bounds.bottom()+5, 2);
    }*/
}
void Graph::DrawYAxis(QSGNode * rootNode) {
    QRectF bounds = boundingRect();
    // Y AXIS FEATURES
    for (QList<float>::iterator i = yAxis.major.begin(); i != yAxis.major.end(); i++) {
        float x = yLabelOffset;
        float y = graphToNodeY(*i);

        _drawLine(rootNode, m_primaryLineColor, bounds.left(), y, bounds.right(), y, 2);
        _drawLabel(x, y, QString::number(*i), yAxisLabels);
    }

    for (QList<float>::iterator i = yAxis.minor.begin(); i != yAxis.minor.end(); i++) {
        float x = yLabelOffset;
        float y = graphToNodeY(*i);

        _drawLine(rootNode, m_primaryLineColor.darker(), bounds.left(), y, bounds.right(), y, 1);
        _drawLabel(x, y, QString::number(*i), yAxisLabels);
    }

    for (QList<float>::iterator i = yAxis.subminor.begin(); i != yAxis.subminor.end(); i++) {
        float x = yLabelOffset;
        float y = graphToNodeY(*i);

        _drawLine(rootNode, m_primaryLineColor.darker(), bounds.left(), y, bounds.right(), y, 1);
        _drawLabel(x, y, QString::number(*i), yAxisLabels);
    }

    // We can draw ticks, but the PPA prototype didn't have any
    /*for (QList<float>::iterator i = yAxis.tick.begin(); i != yAxis.tick.end(); i++) {
        float y = graphToNodeY(*i);

        _drawLine(rootNode, QColor(255, 255, 255, 255), bounds.left(), y, bounds.left()-5, y, 2);
    }*/
}
Esempio n. 3
0
void Button::draw() {
  if (_active) {
    _drawLabel(getLabel(), getFgActive(), getBgActive());
  } else if (_pressed) {
    _drawLabel(getLabel(), getFgPressed(), getBgPressed());
  } else {
    _drawLabel(getLabel(), getFgColor(), getBgColor());    
  }
}
Esempio n. 4
0
void Label::draw() {
  _drawLabel(_label, _fg, _bg);
}