Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 894bf1fb authored by Boudewijn Rempt's avatar Boudewijn Rempt

Revert "Wrap KoShapeBackground in QPointer"

This reverts commit dcecbd47724d2ef34e7465c126b685ae9f8aadbb.
parent b4984375
......@@ -19,9 +19,8 @@
#include "kis_shape_selection_model.h"
#include "kis_debug.h"
#include <KoShapeContainer.h>
#include <KoShapeBackground.h>
#include <KoShapeManager.h>
#include "KoShapeContainer.h"
#include "KoShapeManager.h"
#include "kis_shape_selection.h"
#include "kis_selection.h"
......
......@@ -135,9 +135,9 @@ void KisToolShape::addShape(KoShape* shape)
break;
case KisPainter::FillStylePattern:
if (imageCollection) {
QPointer<KoPatternBackground> fill = new KoPatternBackground(imageCollection);
KoPatternBackground* fill = new KoPatternBackground(imageCollection);
fill->setPattern(currentPattern()->image());
shape->setBackground(fill.data());
shape->setBackground(fill);
} else {
shape->setBackground(0);
}
......@@ -147,8 +147,8 @@ void KisToolShape::addShape(KoShape* shape)
QLinearGradient *gradient = new QLinearGradient(QPointF(0, 0), QPointF(1, 1));
gradient->setCoordinateMode(QGradient::ObjectBoundingMode);
gradient->setStops(currentGradient()->toQGradient()->stops());
QPointer<KoGradientBackground> gradientFill = new KoGradientBackground(gradient);
shape->setBackground(gradientFill.data());
KoGradientBackground* gradientFill = new KoGradientBackground(gradient);
shape->setBackground(gradientFill);
}
break;
case KisPainter::FillStyleNone:
......
......@@ -727,8 +727,10 @@ void KoConnectionShape::shapeChanged(ChangeType type, KoShape *shape)
case BackgroundChanged:
{
// connection shape should not have a background
QPointer<KoShapeBackground> fill = background();
KoShapeBackground *fill = background();
if (fill) {
if (fill->deref())
delete fill;
setBackground(0);
}
return;
......
......@@ -210,9 +210,9 @@ void KoOdfWorkaround::fixPresentationPlaceholder(KoShape *shape)
}
}
QPointer<KoColorBackground> KoOdfWorkaround::fixBackgroundColor(const KoShape *shape, KoShapeLoadingContext &context)
KoColorBackground *KoOdfWorkaround::fixBackgroundColor(const KoShape *shape, KoShapeLoadingContext &context)
{
QPointer<KoColorBackground> colorBackground = 0;
KoColorBackground *colorBackground = 0;
KoOdfLoadingContext &odfContext = context.odfLoadingContext();
if (odfContext.generatorType() == KoOdfLoadingContext::OpenOffice) {
const KoPathShape *pathShape = dynamic_cast<const KoPathShape*>(shape);
......
......@@ -26,8 +26,6 @@
#include "KoTextShapeDataBase.h"
#include <qnamespace.h>
#include <QPointer>
class KoXmlElement;
class KoShape;
class KoShapeLoadingContext;
......@@ -73,7 +71,7 @@ namespace KoOdfWorkaround
FLAKE_EXPORT QColor fixMissingFillColor(const KoXmlElement &element, KoShapeLoadingContext &context);
FLAKE_EXPORT bool fixMissingStyle_DisplayLabel(const KoXmlElement &element, KoShapeLoadingContext &context);
FLAKE_EXPORT QPointer<KoColorBackground> fixBackgroundColor(const KoShape *shape, KoShapeLoadingContext &context);
FLAKE_EXPORT KoColorBackground *fixBackgroundColor(const KoShape *shape, KoShapeLoadingContext &context);
/**
* Old versions of ooimpress does not set the placeholder for shapes that should have it set
......
......@@ -128,6 +128,8 @@ KoShapePrivate::~KoShapePrivate()
delete stroke;
if (shadow && !shadow->deref())
delete shadow;
if (fill && !fill->deref())
delete fill;
if (filterEffectStack && !filterEffectStack->deref())
delete filterEffectStack;
delete clipPath;
......@@ -1004,15 +1006,19 @@ KoShapeAnchor *KoShape::anchor() const
return d->anchor;
}
void KoShape::setBackground(QPointer<KoShapeBackground> fill)
void KoShape::setBackground(KoShapeBackground *fill)
{
Q_D(KoShape);
if (d->fill)
d->fill->deref();
d->fill = fill;
if (d->fill)
d->fill->ref();
d->shapeChanged(BackgroundChanged);
notifyChanged();
}
QPointer<KoShapeBackground> KoShape::background() const
KoShapeBackground *KoShape::background() const
{
Q_D(const KoShape);
return d->fill;
......@@ -1272,7 +1278,7 @@ QString KoShape::saveStyle(KoGenStyle &style, KoShapeSavingContext &context) con
if (s)
s->fillStyle(style, context);
QPointer<KoShapeBackground> bg = background();
KoShapeBackground *bg = background();
if (bg) {
bg->fillStyle(style, context);
}
......@@ -1379,7 +1385,10 @@ void KoShape::loadStyle(const KoXmlElement &element, KoShapeLoadingContext &cont
KoStyleStack &styleStack = context.odfLoadingContext().styleStack();
styleStack.setTypeProperties("graphic");
d->fill = 0;
if (d->fill && !d->fill->deref()) {
delete d->fill;
d->fill = 0;
}
if (d->stroke && !d->stroke->deref()) {
delete d->stroke;
d->stroke = 0;
......@@ -1562,10 +1571,10 @@ bool KoShape::loadOdfAttributes(const KoXmlElement &element, KoShapeLoadingConte
return true;
}
QPointer<KoShapeBackground> KoShape::loadOdfFill(KoShapeLoadingContext &context) const
KoShapeBackground *KoShape::loadOdfFill(KoShapeLoadingContext &context) const
{
QString fill = KoShapePrivate::getStyleProperty("fill", context);
QPointer<KoShapeBackground> bg = 0;
KoShapeBackground *bg = 0;
if (fill == "solid") {
bg = new KoColorBackground();
}
......
......@@ -27,7 +27,6 @@
#include "KoFlake.h"
#include "KoConnectionPoint.h"
#include <QPointer>
#include <QTransform>
#include <QVector>
#include <QSet>
......@@ -485,7 +484,7 @@ public:
* if it is transparent or not.
* @param background the new shape background.
*/
void setBackground(QPointer<KoShapeBackground> background);
void setBackground(KoShapeBackground *background);
/**
* return the brush used to paint te background of this shape with.
......@@ -494,7 +493,7 @@ public:
* will be able to tell if its transparent or not.
* @return the background-brush
*/
QPointer<KoShapeBackground> background() const;
KoShapeBackground *background() const;
/**
* Returns true if there is some transparency, false if the shape is fully opaque.
......@@ -1164,7 +1163,7 @@ protected:
KoShapeStrokeModel *loadOdfStroke(const KoXmlElement &element, KoShapeLoadingContext &context) const;
/// Loads the shadow style
QPointer<KoShapeBackground> loadOdfFill(KoShapeLoadingContext &context) const;
KoShapeBackground *loadOdfFill(KoShapeLoadingContext &context) const;
/// Loads the connection points
void loadOdfGluePoints(const KoXmlElement &element, KoShapeLoadingContext &context);
......
......@@ -18,10 +18,10 @@
*/
#include "KoShapeBackground.h"
#include "KoShapeBackground_p.h"
KoShapeBackgroundPrivate::KoShapeBackgroundPrivate()
: refCount(0)
{
}
......@@ -34,8 +34,6 @@ KoShapeBackground::KoShapeBackground(KoShapeBackgroundPrivate &dd)
{
}
KoShapeBackground::KoShapeBackground()
: d_ptr(new KoShapeBackgroundPrivate())
{
......@@ -50,3 +48,21 @@ bool KoShapeBackground::hasTransparency() const
{
return false;
}
bool KoShapeBackground::ref()
{
Q_D(KoShapeBackground);
return d->refCount.ref();
}
bool KoShapeBackground::deref()
{
Q_D(KoShapeBackground);
return d->refCount.deref();
}
int KoShapeBackground::useCount() const
{
Q_D(const KoShapeBackground);
return d->refCount;
}
......@@ -22,9 +22,6 @@
#include "flake_export.h"
#include <QObject>
#include <QPointer>
class QSizeF;
class QPainter;
class QPainterPath;
......@@ -40,9 +37,8 @@ class KoViewConverter;
* Derived classes are used to paint the background of
* a shape within a given painter path.
*/
class FLAKE_EXPORT KoShapeBackground : public QObject // For use with QPointer
class FLAKE_EXPORT KoShapeBackground
{
Q_OBJECT
public:
KoShapeBackground();
virtual ~KoShapeBackground();
......@@ -63,13 +59,25 @@ public:
/// load background from odf styles
virtual bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize) = 0;
/**
* Increments the use-value.
* Returns true if the new value is non-zero, false otherwise.
*/
bool ref();
/**
* Decrements the use-value.
* Returns true if the new value is non-zero, false otherwise.
*/
bool deref();
/// Return the usage count
int useCount() const;
protected:
KoShapeBackground(KoShapeBackgroundPrivate &);
KoShapeBackgroundPrivate *d_ptr;
private:
Q_DECLARE_PRIVATE(KoShapeBackground)
};
#endif // KOSHAPEBACKGROUND_H
......@@ -20,11 +20,14 @@
#ifndef KoShapeBackgroundPrivate_H
#define KoShapeBackgroundPrivate_H
#include <QAtomicInt>
class KoShapeBackgroundPrivate
{
public:
KoShapeBackgroundPrivate();
virtual ~KoShapeBackgroundPrivate();
QAtomicInt refCount;
};
#endif
......@@ -69,7 +69,7 @@ public:
KoShapeUserData *userData;
KoShapeApplicationData *appData;
KoShapeStrokeModel *stroke; ///< points to a stroke, or 0 if there is no stroke
QPointer<KoShapeBackground> fill; ///< Stands for the background color / fill etc.
KoShapeBackground * fill; ///< Stands for the background color / fill etc.
QList<KoShape*> dependees; ///< list of shape dependent on this shape
KoShapeShadow * shadow; ///< the current shape shadow
KoClipPath * clipPath; ///< the current clip path
......
......@@ -30,26 +30,36 @@ public:
Private() {
}
~Private() {
oldFills.clear();
newFills.clear();
foreach(KoShapeBackground* fill, oldFills) {
if (fill && !fill->deref())
delete fill;
}
foreach(KoShapeBackground* fill, newFills) {
if (fill && !fill->deref())
delete fill;
}
}
void addOldFill(QPointer<KoShapeBackground> oldFill)
void addOldFill(KoShapeBackground * oldFill)
{
if (oldFill)
oldFill->ref();
oldFills.append(oldFill);
}
void addNewFill(QPointer<KoShapeBackground> newFill)
void addNewFill(KoShapeBackground * newFill)
{
if (newFill)
newFill->ref();
newFills.append(newFill);
}
QList<KoShape*> shapes; ///< the shapes to set background for
QList<QPointer<KoShapeBackground> > oldFills;
QList<QPointer<KoShapeBackground> > newFills;
QList<KoShapeBackground*> oldFills;
QList<KoShapeBackground*> newFills;
};
KoShapeBackgroundCommand::KoShapeBackgroundCommand(const QList<KoShape*> &shapes, QPointer<KoShapeBackground> fill,
KoShapeBackgroundCommand::KoShapeBackgroundCommand(const QList<KoShape*> &shapes, KoShapeBackground * fill,
KUndo2Command *parent)
: KUndo2Command(parent)
, d(new Private())
......@@ -63,7 +73,7 @@ KoShapeBackgroundCommand::KoShapeBackgroundCommand(const QList<KoShape*> &shapes
setText(i18nc("(qtundo-format)", "Set background"));
}
KoShapeBackgroundCommand::KoShapeBackgroundCommand(KoShape * shape, QPointer<KoShapeBackground> fill, KUndo2Command *parent)
KoShapeBackgroundCommand::KoShapeBackgroundCommand(KoShape * shape, KoShapeBackground * fill, KUndo2Command *parent)
: KUndo2Command(parent)
, d(new Private())
{
......@@ -74,7 +84,7 @@ KoShapeBackgroundCommand::KoShapeBackgroundCommand(KoShape * shape, QPointer<KoS
setText(i18nc("(qtundo-format)", "Set background"));
}
KoShapeBackgroundCommand::KoShapeBackgroundCommand(const QList<KoShape*> &shapes, const QList<QPointer<KoShapeBackground> > &fills, KUndo2Command *parent)
KoShapeBackgroundCommand::KoShapeBackgroundCommand(const QList<KoShape*> &shapes, const QList<KoShapeBackground*> &fills, KUndo2Command *parent)
: KUndo2Command(parent)
, d(new Private())
{
......@@ -82,7 +92,7 @@ KoShapeBackgroundCommand::KoShapeBackgroundCommand(const QList<KoShape*> &shapes
foreach(KoShape *shape, d->shapes) {
d->addOldFill(shape->background());
}
foreach (QPointer<KoShapeBackground> fill, fills) {
foreach (KoShapeBackground * fill, fills) {
d->addNewFill(fill);
}
......@@ -92,7 +102,7 @@ KoShapeBackgroundCommand::KoShapeBackgroundCommand(const QList<KoShape*> &shapes
void KoShapeBackgroundCommand::redo()
{
KUndo2Command::redo();
QList<QPointer<KoShapeBackground> >::iterator brushIt = d->newFills.begin();
QList<KoShapeBackground*>::iterator brushIt = d->newFills.begin();
foreach(KoShape *shape, d->shapes) {
shape->setBackground(*brushIt);
shape->update();
......@@ -103,7 +113,7 @@ void KoShapeBackgroundCommand::redo()
void KoShapeBackgroundCommand::undo()
{
KUndo2Command::undo();
QList<QPointer<KoShapeBackground> >::iterator brushIt = d->oldFills.begin();
QList<KoShapeBackground*>::iterator brushIt = d->oldFills.begin();
foreach(KoShape *shape, d->shapes) {
shape->setBackground(*brushIt);
shape->update();
......
......@@ -26,7 +26,6 @@
#include <kundo2command.h>
#include <QList>
#include <QBrush>
#include <QPointer>
class KoShape;
class KoShapeBackground;
......@@ -41,7 +40,7 @@ public:
* @param fill the new shape background
* @param parent the parent command used for macro commands
*/
KoShapeBackgroundCommand(const QList<KoShape*> &shapes, QPointer<KoShapeBackground> fill, KUndo2Command *parent = 0);
KoShapeBackgroundCommand(const QList<KoShape*> &shapes, KoShapeBackground *fill, KUndo2Command *parent = 0);
/**
* Command to set a new shape background.
......@@ -49,7 +48,7 @@ public:
* @param fill the new shape background
* @param parent the parent command used for macro commands
*/
KoShapeBackgroundCommand(KoShape *shape, QPointer<KoShapeBackground> fill, KUndo2Command *parent = 0);
KoShapeBackgroundCommand(KoShape *shape, KoShapeBackground *fill, KUndo2Command *parent = 0);
/**
* Command to set new shape backgrounds.
......@@ -57,7 +56,7 @@ public:
* @param fills the new backgrounds, one for each shape
* @param parent the parent command used for macro commands
*/
KoShapeBackgroundCommand(const QList<KoShape*> &shapes, const QList<QPointer<KoShapeBackground> > &fills, KUndo2Command *parent = 0);
KoShapeBackgroundCommand(const QList<KoShape*> &shapes, const QList<KoShapeBackground*> &fills, KUndo2Command *parent = 0);
virtual ~KoShapeBackgroundCommand();
/// redo the command
......
......@@ -541,7 +541,7 @@ void SvgParser::applyFillStyle(KoShape *shape)
SvgGradientHelper *gradient = findGradient(gc->fillId);
if (gradient) {
// great, we have a gradient fill
QPointer<KoGradientBackground> bg = 0;
KoGradientBackground *bg = 0;
if (gradient->gradientUnits() == SvgGradientHelper::ObjectBoundingBox) {
bg = new KoGradientBackground(*gradient->gradient());
bg->setTransform(gradient->transform());
......@@ -552,7 +552,7 @@ void SvgParser::applyFillStyle(KoShape *shape)
QTransform invShapematrix = shape->transformation().inverted();
bg->setTransform(gradient->transform() * gc->matrix * invShapematrix);
}
shape->setBackground(bg.data());
shape->setBackground(bg);
} else {
// try to find referenced pattern
SvgPatternHelper *pattern = findPattern(gc->fillId);
......@@ -592,7 +592,7 @@ void SvgParser::applyFillStyle(KoShape *shape)
qDeleteAll(patternContent);
if (!image.isNull()) {
QPointer<KoPatternBackground> bg = new KoPatternBackground(imageCollection);
KoPatternBackground *bg = new KoPatternBackground(imageCollection);
bg->setPattern(image);
QPointF refPoint = shape->documentToShape(pattern->position(objectBound));
......@@ -624,7 +624,7 @@ void SvgParser::applyFillStyle(KoShape *shape)
qreal offsetY = 100.0 * (refPoint.y() - fy * tileSize.height()) / tileSize.height();
bg->setReferencePointOffset(QPointF(offsetX, offsetY));
shape->setBackground(bg.data());
shape->setBackground(bg);
}
} else {
// no referenced fill found, use fallback color
......@@ -1267,7 +1267,7 @@ KoShape * SvgParser::createShapeFromElement(const KoXmlElement &element, SvgLoad
delete oldStroke;
// reset fill
QPointer<KoShapeBackground> oldFill = shape->background();
KoShapeBackground *oldFill = shape->background();
shape->setBackground(0);
delete oldFill;
......@@ -1312,7 +1312,7 @@ KoShape * SvgParser::createShape(const QString &shapeID)
delete oldStroke;
// reset fill
QPointer<KoShapeBackground> oldFill = shape->background();
KoShapeBackground *oldFill = shape->background();
shape->setBackground(0);
delete oldFill;
......
......@@ -74,18 +74,18 @@ void SvgStyleWriter::saveSvgFill(KoShape *shape, SvgSavingContext &context)
}
QBrush fill(Qt::NoBrush);
QPointer<KoColorBackground> cbg = dynamic_cast<KoColorBackground*>(shape->background().data());
KoColorBackground * cbg = dynamic_cast<KoColorBackground*>(shape->background());
if (cbg) {
context.shapeWriter().addAttribute("fill", cbg->color().name());
if (cbg->color().alphaF() < 1.0)
context.shapeWriter().addAttribute("fill-opacity", cbg->color().alphaF());
}
QPointer<KoGradientBackground> gbg = dynamic_cast<KoGradientBackground*>(shape->background().data());
KoGradientBackground * gbg = dynamic_cast<KoGradientBackground*>(shape->background());
if (gbg) {
QString gradientId = saveSvgGradient(gbg->gradient(), gbg->transform(), context);
context.shapeWriter().addAttribute("fill", "url(#" + gradientId + ")");
}
QPointer<KoPatternBackground> pbg = dynamic_cast<KoPatternBackground*>(shape->background().data());
KoPatternBackground * pbg = dynamic_cast<KoPatternBackground*>(shape->background());
if (pbg) {
const QString patternId = saveSvgPattern(pbg, shape, context);
context.shapeWriter().addAttribute("fill", "url(#" + patternId + ")");
......@@ -284,7 +284,7 @@ QString SvgStyleWriter::saveSvgGradient(const QGradient *gradient, const QTransf
return uid;
}
QString SvgStyleWriter::saveSvgPattern(QPointer<KoPatternBackground> pattern, KoShape *shape, SvgSavingContext &context)
QString SvgStyleWriter::saveSvgPattern(KoPatternBackground *pattern, KoShape *shape, SvgSavingContext &context)
{
const QString uid = context.createUID("pattern");
......
......@@ -31,7 +31,6 @@
#include "flake_export.h"
#include <QGradient>
#include <QPointer>
class SvgSavingContext;
class KoShape;
......@@ -59,7 +58,7 @@ protected:
/// Saves gradient
static QString saveSvgGradient(const QGradient *gradient, const QTransform &gradientTransform, SvgSavingContext &context);
/// Saves pattern
static QString saveSvgPattern(QPointer<KoPatternBackground> pattern, KoShape *shape, SvgSavingContext &context);
static QString saveSvgPattern(KoPatternBackground *pattern, KoShape *shape, SvgSavingContext &context);
};
#endif // SVGSTYLEWRITER_H
......@@ -27,12 +27,13 @@
void TestShapeBackgroundCommand::refCounting()
{
MockShape * shape1 = new MockShape();
QPointer<KoShapeBackground> whiteFill = new KoColorBackground(QColor(Qt::white));
QPointer<KoShapeBackground> blackFill = new KoColorBackground(QColor(Qt::black));
QPointer<KoShapeBackground> redFill = new KoColorBackground(QColor(Qt::red));
KoShapeBackground * whiteFill = new KoColorBackground(QColor(Qt::white));
KoShapeBackground * blackFill = new KoColorBackground(QColor(Qt::black));
KoShapeBackground * redFill = new KoColorBackground(QColor(Qt::red));
shape1->setBackground(whiteFill);
QVERIFY(shape1->background() == whiteFill);
QCOMPARE(whiteFill->useCount(), 1);
// old fill is white, new fill is black
KUndo2Command *cmd1 = new KoShapeBackgroundCommand(shape1, blackFill);
......
......@@ -135,7 +135,7 @@ QString KoPAPageBase::saveOdfPageStyle( KoPASavingContext &paContext ) const
void KoPAPageBase::saveOdfPageStyleData( KoGenStyle &style, KoPASavingContext &paContext ) const
{
QPointer<KoShapeBackground> bg = background();
KoShapeBackground * bg = background();
if( bg )
bg->fillStyle( style, paContext );
}
......
......@@ -114,7 +114,7 @@ void KoPABackgroundToolWidget::setBackgroundImage()
i18nc( "(qtundo-format)", "Change slide background image") :
i18nc( "(qtundo-format)", "Change page background image");
KUndo2Command * cmd = new KUndo2Command(commandTitle);
QPointer<KoPatternBackground> bg = new KoPatternBackground( collection );
KoPatternBackground * bg = new KoPatternBackground( collection );
bg->setPattern( image );
QSizeF imageSize = bg->patternOriginalSize();
QSizeF pageSize = m_tool->view()->activePage()->size();
......@@ -134,7 +134,7 @@ void KoPABackgroundToolWidget::setBackgroundImage()
}
bg->setRepeat( repeat );
new KoShapeBackgroundCommand( page, bg.data(), cmd );
new KoShapeBackgroundCommand( page, bg, cmd );
m_tool->canvas()->addCommand( cmd );
}
}
......
......@@ -246,14 +246,14 @@ KoFillConfigWidget::KoFillConfigWidget(QWidget *parent)
KoAbstractResourceServerAdapter *gradientResourceAdapter = new KoResourceServerAdapter<KoAbstractGradient>(serverProvider->gradientServer(), this);
d->gradientAction = new KoResourcePopupAction(gradientResourceAdapter, d->colorButton);
d->gradientAction->setToolTip(i18n("Change the filling color"));
connect(d->gradientAction, SIGNAL(resourceSelected(QPointer<KoShapeBackground> )), this, SLOT(gradientChanged(QPointer<KoShapeBackground> )));
connect(d->gradientAction, SIGNAL(resourceSelected(KoShapeBackground*)), this, SLOT(gradientChanged(KoShapeBackground*)));
connect(d->colorButton, SIGNAL(iconSizeChanged()), d->gradientAction, SLOT(updateIcon()));
// Pattern selector
KoAbstractResourceServerAdapter *patternResourceAdapter = new KoResourceServerAdapter<KoPattern>(serverProvider->patternServer(), this);
d->patternAction = new KoResourcePopupAction(patternResourceAdapter, d->colorButton);
d->patternAction->setToolTip(i18n("Change the filling color"));
connect(d->patternAction, SIGNAL(resourceSelected(QPointer<KoShapeBackground> )), this, SLOT(patternChanged(QPointer<KoShapeBackground> )));
connect(d->patternAction, SIGNAL(resourceSelected(KoShapeBackground*)), this, SLOT(patternChanged(KoShapeBackground*)));
connect(d->colorButton, SIGNAL(iconSizeChanged()), d->patternAction, SLOT(updateIcon()));
// Spacer
......@@ -338,7 +338,7 @@ void KoFillConfigWidget::colorChanged()
return;
}
QPointer<KoShapeBackground> fill = new KoColorBackground(d->colorAction->currentColor());
KoShapeBackground *fill = new KoColorBackground(d->colorAction->currentColor());
QList<KoShape*> selectedShapes = selection->selectedShapes();
if (selectedShapes.isEmpty()) {
......@@ -356,7 +356,7 @@ void KoFillConfigWidget::colorChanged()
canvasController->canvas()->addCommand(firstCommand);
}
void KoFillConfigWidget::gradientChanged(QPointer<KoShapeBackground> background)
void KoFillConfigWidget::gradientChanged(KoShapeBackground* background)
{
KoCanvasController *canvasController = KoToolManager::instance()->activeCanvasController();
KoSelection *selection = canvasController->canvas()->shapeManager()->selection();
......@@ -370,7 +370,7 @@ void KoFillConfigWidget::gradientChanged(QPointer<KoShapeBackground> background
return;
}
QPointer<KoGradientBackground> gradientBackground = dynamic_cast<KoGradientBackground*>(background.data());
KoGradientBackground *gradientBackground = dynamic_cast<KoGradientBackground*>(background);
if (! gradientBackground) {
return;
}
......@@ -380,7 +380,7 @@ void KoFillConfigWidget::gradientChanged(QPointer<KoShapeBackground> background
KUndo2Command *firstCommand = 0;
foreach (KoShape *shape, selectedShapes) {
QPointer<KoShapeBackground> fill = applyFillGradientStops(shape, newStops);
KoShapeBackground *fill = applyFillGradientStops(shape, newStops);
if (! fill) {
continue;
}
......@@ -393,7 +393,7 @@ void KoFillConfigWidget::gradientChanged(QPointer<KoShapeBackground> background
canvasController->canvas()->addCommand(firstCommand);
}
void KoFillConfigWidget::patternChanged(QPointer<KoShapeBackground> background)
void KoFillConfigWidget::patternChanged(KoShapeBackground* background)
{
KoCanvasController *canvasController = KoToolManager::instance()->activeCanvasController();
KoSelection *selection = canvasController->canvas()->shapeManager()->selection();
......@@ -402,7 +402,7 @@ void KoFillConfigWidget::patternChanged(QPointer<KoShapeBackground> background)
return;
}
QPointer<KoPatternBackground> patternBackground = dynamic_cast<KoPatternBackground*>(background.data());
KoPatternBackground *patternBackground = dynamic_cast<KoPatternBackground*>(background);
if (! patternBackground) {
return;
}
......@@ -414,9 +414,9 @@ void KoFillConfigWidget::patternChanged(QPointer<KoShapeBackground> background)
KoImageCollection *imageCollection = canvasController->canvas()->shapeController()->resourceManager()->imageCollection();
if (imageCollection) {
QPointer<KoPatternBackground> fill = new KoPatternBackground(imageCollection);
KoPatternBackground *fill = new KoPatternBackground(imageCollection);
fill->setPattern(patternBackground->pattern());
canvasController->canvas()->addCommand(new KoShapeBackgroundCommand(selectedShapes, fill.data()));
canvasController->canvas()->addCommand(new KoShapeBackgroundCommand(selectedShapes, fill));
}
}
......@@ -454,7 +454,7 @@ void KoFillConfigWidget::updateWidget(KoShape *shape)
shape->waitUntilReady(zoomHandler, false);
d->colorButton->setEnabled(true);
QPointer<KoShapeBackground> background = shape->background();
KoShapeBackground *background = shape->background();
if (! background) {
// No Fill
d->group->button(KoFillConfigWidget::None)->setChecked(true);
......@@ -464,9 +464,9 @@ void KoFillConfigWidget::updateWidget(KoShape *shape)
return;
}
QPointer<KoColorBackground> colorBackground = dynamic_cast<KoColorBackground*>(background.data());
QPointer<KoGradientBackground> gradientBackground = dynamic_cast<KoGradientBackground*>(background.data());
QPointer<KoPatternBackground> patternBackground = dynamic_cast<KoPatternBackground*>(background.data());