void LinkDialogProcessorGraphicsItem::paint(QPainter* p, const QStyleOptionGraphicsItem* options,
                                            QWidget* widget) {
    IVW_UNUSED_PARAM(options);
    IVW_UNUSED_PARAM(widget);
    p->save();

    QPen blackPen(QColor(0, 0, 0), 1);

    p->setPen(blackPen);
    p->setRenderHint(QPainter::Antialiasing, true);
    p->setViewTransformEnabled(false);
    QColor topColor(140, 140, 140);
    QColor middleColor(59, 61, 61);
    QColor bottomColor(40, 40, 40);
    // paint processor
    QLinearGradient grad(rect().topLeft(), rect().bottomLeft());

    grad.setColorAt(0.0f, topColor);
    grad.setColorAt(0.2f, middleColor);
    grad.setColorAt(1.0f, bottomColor);

    p->setBrush(grad);
    p->drawRoundedRect(rect(), linkdialog::processorRoundedCorners,
                       linkdialog::processorRoundedCorners);
    p->restore();
}
Ejemplo n.º 2
0
void LinkGraphicsItem::paint(QPainter* p, const QStyleOptionGraphicsItem* options,
                             QWidget* widget) {
    IVW_UNUSED_PARAM(options);
    IVW_UNUSED_PARAM(widget);

    if (isSelected())
        p->setPen(QPen(Qt::darkRed, 2.0, Qt::DotLine, Qt::RoundCap));
    else
        p->setPen(QPen(color_, 2.0, Qt::DotLine, Qt::RoundCap));

    p->drawPath(path_);
}
Ejemplo n.º 3
0
void ConsoleWidget::log(std::string logSource, LogLevel level, LogAudience audience,
                        const char* fileName, const char* function, int line, std::string msg) {
    IVW_UNUSED_PARAM(function);

    QString message;
    std::string lineNo = toString(line);
    switch (audience) {
        case inviwo::LogAudience::User: {
            message = QString::fromStdString("(" + logSource + ") " + msg);

            break;
        }
        case inviwo::LogAudience::Developer: {
            switch (level) {
                case LogLevel::Error:
                case LogLevel::Warn: {
                    message =
                        QString::fromStdString("(" + logSource + ") [" + std::string(fileName) +
                                               ", " + lineNo + "]: " + msg);
                    break;
                }
                case LogLevel::Info:
                default: {
                    message = QString::fromStdString("(" + logSource + ") " + msg);
                    break;
                }
            }
            break;
        }
        default:
            break;
    }

    logMessage(level, message);
}
Ejemplo n.º 4
0
void CurveGraphicsItem::paint(QPainter* p, const QStyleOptionGraphicsItem* options,
                              QWidget* widget) {
    IVW_UNUSED_PARAM(options);
    IVW_UNUSED_PARAM(widget);

    QColor color = getColor();

    if (isSelected()) {
        p->setPen(QPen(selectedBorderColor_, 4.0, Qt::SolidLine, Qt::RoundCap));
    } else {
        p->setPen(QPen(borderColor_, 3.0, Qt::SolidLine, Qt::RoundCap));
    }
    p->drawPath(path_);
    p->setPen(QPen(color, 2.0, Qt::SolidLine, Qt::RoundCap));
    p->drawPath(path_);
}
void TransferFunctionControlPointConnection::paint(QPainter* p,
                                                   const QStyleOptionGraphicsItem* options,
                                                   QWidget* widget) {
    IVW_UNUSED_PARAM(options);
    IVW_UNUSED_PARAM(widget);

    p->save();
    p->setRenderHint(QPainter::Antialiasing, true);

    QPen pathPen(QColor(66, 66, 66));
    pathPen.setWidth(3);
    pathPen.setCosmetic(true);
    
    p->setPen(pathPen);
    p->drawPath(path_);
    p->restore();
}
void LinkDialogProcessorGraphicsItem::paint(QPainter* p, const QStyleOptionGraphicsItem* options,
                                            QWidget* widget) {
    IVW_UNUSED_PARAM(options);
    IVW_UNUSED_PARAM(widget);
    p->save();
    p->setPen(Qt::black);
    p->setRenderHint(QPainter::Antialiasing, true);
    QColor topColor(140, 140, 140);
    QColor middleColor(59, 61, 61);
    QColor bottomColor(40, 40, 40);
    // paint processor
    QLinearGradient grad(rect().topLeft(), rect().bottomLeft());

    if (isSelected()) {
        grad.setColorAt(0.0f, topColor);
        grad.setColorAt(0.2f, middleColor);
        grad.setColorAt(0.5f, Qt::darkRed);
        grad.setColorAt(1.0f, bottomColor);
    } else {
        grad.setColorAt(0.0f, topColor);
        grad.setColorAt(0.2f, middleColor);
        grad.setColorAt(1.0f, bottomColor);
    }

    p->setBrush(grad);
    QPainterPath roundRectPath;
    QRectF bRect = rect();
    roundRectPath.moveTo(bRect.left(), bRect.top() + processorRoundedCorners);
    roundRectPath.lineTo(bRect.left(), bRect.bottom() - processorRoundedCorners);
    roundRectPath.arcTo(bRect.left(), bRect.bottom() - (2 * processorRoundedCorners),
                        (2 * processorRoundedCorners), (2 * processorRoundedCorners), 180.0, 90.0);
    roundRectPath.lineTo(bRect.right() - processorRoundedCorners, bRect.bottom());
    roundRectPath.arcTo(bRect.right() - (2 * processorRoundedCorners),
                        bRect.bottom() - (2 * processorRoundedCorners),
                        (2 * processorRoundedCorners), (2 * processorRoundedCorners), 270.0, 90.0);
    roundRectPath.lineTo(bRect.right(), bRect.top() + processorRoundedCorners);
    roundRectPath.arcTo(bRect.right() - (2 * processorRoundedCorners), bRect.top(),
                        (2 * processorRoundedCorners), (2 * processorRoundedCorners), 0.0, 90.0);
    roundRectPath.lineTo(bRect.left() + processorRoundedCorners, bRect.top());
    roundRectPath.arcTo(bRect.left(), bRect.top(), (2 * processorRoundedCorners),
                        (2 * processorRoundedCorners), 90.0, 90.0);
    p->drawPath(roundRectPath);
    p->restore();
}
Ejemplo n.º 7
0
void MetaData::deserialize(IvwDeserializer& d) {
    IVW_UNUSED_PARAM(d);
}
Ejemplo n.º 8
0
void MetaData::serialize(IvwSerializer& s) const {
    IVW_UNUSED_PARAM(s);
}
Ejemplo n.º 9
0
void ProcessorGraphicsItem::paint(QPainter* p, const QStyleOptionGraphicsItem* options,
                                  QWidget* widget) {
    IVW_UNUSED_PARAM(options);
    IVW_UNUSED_PARAM(widget);
    p->save();
    p->setPen(Qt::NoPen);
    p->setRenderHint(QPainter::Antialiasing, true);
    QColor topColor(140, 140, 140);
    QColor middleColor(59, 61, 61);
    QColor bottomColor(40, 40, 40);
    // paint processor
    QLinearGradient grad(rect().topLeft(), rect().bottomLeft());

    if (isSelected()) {
        grad.setColorAt(0.0f, topColor);
        grad.setColorAt(0.2f, middleColor);
        grad.setColorAt(0.5f, Qt::darkRed);
        grad.setColorAt(1.0f, bottomColor);
    } else {
        grad.setColorAt(0.0f, topColor);
        grad.setColorAt(0.2f, middleColor);
        grad.setColorAt(1.0f, bottomColor);
    }

    QRectF bRect = rect();
    QPainterPath roundRectPath = makeRoundedBox(rect(), roundedCorners);

    p->setBrush(grad);
    p->drawPath(roundRectPath);
    QLinearGradient highlightGrad(rect().topLeft(), rect().bottomLeft());

    if (isSelected()) {
        highlightGrad.setColorAt(0.0f, bottomColor);
        highlightGrad.setColorAt(0.1f, bottomColor);
        highlightGrad.setColorAt(0.5f, Qt::darkRed);
        highlightGrad.setColorAt(1.0f, bottomColor);
    } else {
        highlightGrad.setColorAt(0.0f, bottomColor);
        highlightGrad.setColorAt(1.0f, bottomColor);
    }

    QPainterPath highlightPath;
    float highlightLength = bRect.width() / 8.0;
    highlightPath.moveTo(bRect.left(), bRect.top() + roundedCorners);
    highlightPath.lineTo(bRect.left(), bRect.bottom() - roundedCorners);
    highlightPath.arcTo(bRect.left(), bRect.bottom() - (2 * roundedCorners), (2 * roundedCorners),
                        (2 * roundedCorners), 180.0, 90.0);
    highlightPath.lineTo(bRect.left() + (bRect.width() / 2.0) + highlightLength, bRect.bottom());
    highlightPath.lineTo(bRect.left() + (bRect.width() / 2.0) - highlightLength, bRect.top());
    highlightPath.lineTo(bRect.left() + roundedCorners, bRect.top());
    highlightPath.arcTo(bRect.left(), bRect.top(), (2 * roundedCorners), (2 * roundedCorners), 90.0,
                        90.0);

    p->setBrush(highlightGrad);
    p->drawPath(highlightPath);
    p->setPen(QPen(QColor(164, 164, 164), 1.0));
    p->setBrush(Qt::NoBrush);
    p->drawPath(roundRectPath);

    p->restore();
}