bool Image::setProperty(P_ID propertyId, const QVariant& v) { bool rv = true; score()->addRefresh(canvasBoundingRect()); switch(propertyId) { case P_AUTOSCALE: setAutoScale(v.toBool()); break; case P_SIZE: setSize(v.toSizeF()); break; case P_SCALE: setScale(v.toSizeF()); break; case P_LOCK_ASPECT_RATIO: setLockAspectRatio(v.toBool()); break; case P_SIZE_IS_SPATIUM: setSizeIsSpatium(v.toBool()); break; default: rv = Element::setProperty(propertyId, v); break; } setGenerated(false); score()->setLayoutAll(true); return rv; }
bool Image::setProperty(Pid propertyId, const QVariant& v) { bool rv = true; score()->addRefresh(canvasBoundingRect()); switch(propertyId) { case Pid::AUTOSCALE: setAutoScale(v.toBool()); break; case Pid::SIZE: setSize(v.toSizeF()); break; case Pid::LOCK_ASPECT_RATIO: setLockAspectRatio(v.toBool()); break; case Pid::SIZE_IS_SPATIUM: { QSizeF s = size2pixel(_size); setSizeIsSpatium(v.toBool()); _size = pixel2size(s); } break; default: rv = Element::setProperty(propertyId, v); break; } setGenerated(false); _dirty = true; triggerLayout(); return rv; }
PictureItem::PictureItem(View *parent, const QImage &image) : ViewItem(parent) { if (!image.isNull()) { _image = QPixmap::fromImage(image); } setTypeName("Picture"); setLockAspectRatio(true); setLockAspectRatioFixed(true); }
CircleItem::CircleItem(View *parent) : ViewItem(parent), _circleEditDialog(0) { setTypeName("Circle"); setBrush(Qt::white); setLockAspectRatio(true); setLockAspectRatioFixed(true); applyDialogDefaultsStroke(); applyDialogDefaultsFill(); applyDialogDefaultsLockPosToData(); }
SvgItem::SvgItem(View *parent, const QString &file) : ViewItem(parent) { if (!file.isNull()) { _svg = new QSvgRenderer(file); QFile svgfile(file); if (svgfile.open(QIODevice::ReadOnly | QIODevice::Text)) { while (!svgfile.atEnd()) { _svgData.append(svgfile.readLine()); } } } else { _svg = new QSvgRenderer(); } setTypeName("Svg"); setLockAspectRatio(true); setLockAspectRatioFixed(true); }
SvgItem::SvgItem(View *parent, const QString &file) : ViewItem(parent) { if (!file.isNull()) { _svg = new QSvgRenderer(file); QFile svgfile(file); if (svgfile.open(QIODevice::ReadOnly | QIODevice::Text)) { while (!svgfile.atEnd()) { _svgData.append(svgfile.readLine()); } } } else { _svg = new QSvgRenderer(); } //FIXME need to set the element id?? setName("Svg"); setZValue(SVG_ZVALUE); setLockAspectRatio(true); }