Ejemplo n.º 1
0
TextShape::TextShape(const double x, const double y, const char *txt, int ptSize)
    :ShapeObj(x_shTextShape)
{
    pix.load(":/resources/node_images/bmp_PC_Blue.bmp","bmp");
    CanvasItem::setPos(x, y);
    _colour = Qt::black;
    txtStr = NULL;
    //QT unicodeStr = SDLGui::UTF16_fromChar(txtStr);
    fontSize = ptSize;
    setPainterPath(buildPainterPath());
    setText(txt);
}
Ejemplo n.º 2
0
TextShape::TextShape(QString id, const double x, const double y,
        int w, int h, const char *txt, int ptSize)
    : ShapeObj(x_shTextShape)
{
    pix.load(":/resources/node_images/bmp_PC_Blue.bmp","bmp");
    initWithDimensions(id, x, y, w, h);
    _colour = Qt::black;
    txtStr = NULL;
    //QT unicodeStr = SDLGui::UTF16_fromChar(txtStr);
    fontSize = ptSize;
    setPainterPath(buildPainterPath());
    setText(txt);
}
Ejemplo n.º 3
0
void TextShape::initWithXMLProperties(Canvas *canvas,
        const QDomElement& node, const QString& ns)
{
    // Call equivalent superclass method.
    ShapeObj::initWithXMLProperties(canvas, node, ns);

    //QT unicodeStr = SDLGui::UTF16_fromChar(txtStr);
    fontSize = essentialProp<int>(node, x_fontSize, ns);;
    setPainterPath(buildPainterPath());

    QString value = nodeAttribute(node, ns, x_label);
    if (!value.isNull())
    {
        setText(value);
    }
    routerAdd();
}
Ejemplo n.º 4
0
void FreehandShape::initWithXMLProperties(Canvas *canvas,
        const QDomElement& node, const QString& ns)
{
    // Call equivalent superclass method.
    ShapeObj::initWithXMLProperties(canvas, node, ns);

    // Read in geometry;
    QString value = nodeAttribute(node, ns, x_geometry);
    if (!value.isNull())
    {
        QStringList strings =
                value.split(QRegExp("[, ]"), QString::SkipEmptyParts);
        int stringIndex = 0;

        // Read the number of points.
        int strokes = strings.at(stringIndex++).toInt();

        bool first = true;
        for (int c = 0; c < strokes; ++c)
        {
            int points = strings.at(stringIndex++).toInt();

            if (first == false)
            {
                // XXX: hint vector size?
                _geometry.startNewStroke();
            }

            for (int p = 0; p < points; ++p)
            {
                double x = strings.at(stringIndex++).toDouble();
                double y = strings.at(stringIndex++).toDouble();
                unsigned int t = strings.at(stringIndex++).toUInt();
                _geometry.addPoint(x, y, t);
            }
            first = false;
        }

        double initOffX = strings.at(stringIndex++).toDouble();
        double initOffY = strings.at(stringIndex++).toDouble();
        _geometry.setInitialOffset(initOffX, initOffY);
    }
    setPainterPath(buildPainterPath());
}