Commit 99c07ee6 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Set the name and validity of a brush when copying it

BUG:388570
parent 6bd71e8d
......@@ -138,9 +138,7 @@ KisGbrBrush::KisGbrBrush(const KisGbrBrush& rhs)
: KisScalingSizeBrush(rhs)
, d(new Private(*rhs.d))
{
setName(rhs.name());
d->data = QByteArray();
setValid(rhs.valid());
}
KisGbrBrush::~KisGbrBrush()
......
......@@ -46,7 +46,6 @@ KisPngBrush::KisPngBrush(const KisPngBrush &rhs)
setBrushType(IMAGE);
setHasColor(true);
}
setValid(rhs.valid());
}
KisBrush* KisPngBrush::clone() const
......
......@@ -28,6 +28,13 @@ KisScalingSizeBrush::KisScalingSizeBrush(const QString &filename)
{
}
KisScalingSizeBrush::KisScalingSizeBrush(const KisScalingSizeBrush &rhs)
: KisBrush(rhs)
{
setName(rhs.name());
setValid(rhs.valid());
}
qreal KisScalingSizeBrush::userEffectiveSize() const
{
return this->width() * this->scale();
......
......@@ -29,6 +29,7 @@ public:
KisScalingSizeBrush();
KisScalingSizeBrush(const QString& filename);
KisScalingSizeBrush(const KisScalingSizeBrush &rhs);
qreal userEffectiveSize() const override;
void setUserEffectiveSize(qreal value) override;
......
......@@ -34,8 +34,8 @@ KisSvgBrush::KisSvgBrush(const QString& filename)
}
KisSvgBrush::KisSvgBrush(const KisSvgBrush& rhs)
: KisScalingSizeBrush(rhs),
m_svg(rhs.m_svg)
: KisScalingSizeBrush(rhs)
, m_svg(rhs.m_svg)
{
}
......@@ -95,7 +95,11 @@ bool KisSvgBrush::loadFromDevice(QIODevice *dev)
}
setWidth(brushTipImage().width());
setHeight(brushTipImage().height());
return !brushTipImage().isNull();
QFileInfo fi(filename());
setName(fi.baseName());
return !brushTipImage().isNull() && valid();
}
bool KisSvgBrush::save()
......
......@@ -55,6 +55,7 @@ KoResource::~KoResource()
KoResource::KoResource(const KoResource &rhs)
: d(new Private(*rhs.d))
{
qDebug() << ">>>>>>>>>>>>>>>>>>" << filename() << name() << valid();
}
bool KoResource::saveToDevice(QIODevice *dev) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment