//-----------------------------------------------------------------------------
// Function: ModelParameterVerilogWriter::createDeclaration()
//-----------------------------------------------------------------------------
QString ModelParameterVerilogWriter::createDeclaration() const
{
    QString parameterDeclaration("parameter <type> <arrayBounds> <name> = <default>");

    parameterDeclaration.replace("<type>", modelParameter_->getDataType().leftJustified(7));
    parameterDeclaration.replace("<arrayBounds>", arrayBounds().leftJustified(20));
    //parameterDeclaration.replace("<vectorBounds>", vectorBounds());
    parameterDeclaration.replace("<name>", modelParameter_->getName().leftJustified(16));
    parameterDeclaration.replace("<default>", formattedValue());

    if (modelParameter_->getValue().isEmpty())
    {
        parameterDeclaration.remove(" = ");
    }

    return parameterDeclaration;
}
Exemplo n.º 2
0
void RingChart::drawValue(QPainter &p, const QRect& pieRect,
                           const QModelIndex &index, double value,
                           double angle1, double angle2,
                           bool isHighlighted)
{
    // text (angle CCW in radians)
    double cr = pieRect.height()/2 - 20;
    double textAngle = (360 - angle1 - angle2/2) * M_PI / 180;
    double tx = cr * cos(textAngle) + rect().center().x();
    double ty = cr * sin(textAngle) + rect().center().y();

    if (isHighlighted)
    {
        p.setPen(QPen(m_hlTextColor));
    }
    else
    {
        QPen pen(qvariant_cast<QColor>(m_model->headerData(index.row(), Qt::Vertical, Qt::ForegroundRole)));
        p.setPen(pen);
    }

    p.drawText(tx, ty, formattedValue(value));
}