Ejemplo n.º 1
0
void ChordLine::read(XmlReader& e)
      {
      path = QPainterPath();
      while (e.readNextStartElement()) {
            const QStringRef& tag(e.name());
            if (tag == "Path") {
                  path = QPainterPath();
                  QPointF curveTo;
                  QPointF p1;
                  int state = 0;
                  while (e.readNextStartElement()) {
                        const QStringRef& tag(e.name());
                        if (tag == "Element") {
                              int type = e.intAttribute("type");
                              qreal x  = e.doubleAttribute("x");
                              qreal y  = e.doubleAttribute("y");
                              switch(QPainterPath::ElementType(type)) {
                                    case QPainterPath::MoveToElement:
                                          path.moveTo(x, y);
                                          break;
                                    case QPainterPath::LineToElement:
                                          path.lineTo(x, y);
                                          break;
                                    case QPainterPath::CurveToElement:
                                          curveTo.rx() = x;
                                          curveTo.ry() = y;
                                          state = 1;
                                          break;
                                    case QPainterPath::CurveToDataElement:
                                          if (state == 1) {
                                                p1.rx() = x;
                                                p1.ry() = y;
                                                state = 2;
                                                }
                                          else if (state == 2) {
                                                path.cubicTo(curveTo, p1, QPointF(x, y));
                                                state = 0;
                                                }
                                          break;
                                    }
                              e.skipCurrentElement(); //needed to go to next Element in Path
                              }
                        else
                              e.unknown();
                        }
                  modified = true;
                  }
            else if (tag == "subtype")
                  setChordLineType(ChordLineType(e.readInt()));
             else if (tag == "straight")
                  setStraight(e.readInt());
             else if (tag == "lengthX")
                  setLengthX(e.readInt());
             else if (tag == "lengthY")
                  setLengthY(e.readInt());

            else if (!Element::readProperties(e))
                  e.unknown();
            }
      }
Ejemplo n.º 2
0
int VSCubeWithHolePhantom::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = VSSubphantom::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    
#ifndef QT_NO_PROPERTIES
     if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< float*>(_v) = lengthX(); break;
        case 1: *reinterpret_cast< float*>(_v) = lengthY(); break;
        case 2: *reinterpret_cast< float*>(_v) = lengthZ(); break;
        case 3: *reinterpret_cast< float*>(_v) = holeDiameterX(); break;
        case 4: *reinterpret_cast< float*>(_v) = holeDiameterY(); break;
        case 5: *reinterpret_cast< float*>(_v) = holeOffsetX(); break;
        case 6: *reinterpret_cast< float*>(_v) = holeOffsetY(); break;
        case 7: *reinterpret_cast< float*>(_v) = apodization(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setLengthX(*reinterpret_cast< float*>(_v)); break;
        case 1: setLengthY(*reinterpret_cast< float*>(_v)); break;
        case 2: setLengthZ(*reinterpret_cast< float*>(_v)); break;
        case 3: setHoleDiameterX(*reinterpret_cast< float*>(_v)); break;
        case 4: setHoleDiameterY(*reinterpret_cast< float*>(_v)); break;
        case 5: setHoleOffsetX(*reinterpret_cast< float*>(_v)); break;
        case 6: setHoleOffsetY(*reinterpret_cast< float*>(_v)); break;
        case 7: setApodization(*reinterpret_cast< float*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}