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 fc35e48e authored by Tusooa Zhu's avatar Tusooa Zhu 🔼

Wont compile: Make KoShapePrivate implicitly sharable

parent 8621426b
This diff is collapsed.
......@@ -30,6 +30,7 @@
#include <QSharedPointer>
#include <QSet>
#include <QMetaType>
#include <QSharedDataPointer>
#include <KoXmlReaderForward.h>
......@@ -1206,8 +1207,6 @@ public:
static QList<KoShape*> linearizeSubtree(const QList<KoShape*> &shapes);
protected:
/// constructor
KoShape(KoShapePrivate *);
/* ** loading saving helper methods */
/// attributes from ODF 1.1 chapter 9.2.15 Common Drawing Shape Attributes
......@@ -1294,10 +1293,20 @@ protected:
/// return the current matrix that contains the rotation/scale/position of this shape
QTransform transform() const;
KoShapePrivate *d_ptr;
private:
class Private;
QSharedDataPointer<Private> d;
private:
Q_DECLARE_PRIVATE(KoShape)
/**
* Notify the shape that a change was done. To be used by inheriting shapes.
* @param type the change type
*/
void shapeChangedPriv(KoShape::ChangeType type);
void addShapeManager(KoShapeManager *manager);
void removeShapeManager(KoShapeManager *manager);
friend class KoShapeManager;
};
Q_DECLARE_METATYPE(KoShape*)
......
......@@ -32,33 +32,31 @@
#include "kis_painting_tweaks.h"
#include "kis_assert.h"
KoShapeContainerPrivate::KoShapeContainerPrivate(KoShapeContainer *q)
: KoShapePrivate(q),
shapeInterface(q),
KoShapeContainer::Private::Private(KoShapeContainer *q)
: shapeInterface(q),
model(0)
{
}
KoShapeContainerPrivate::~KoShapeContainerPrivate()
KoShapeContainer::Private::~Private()
{
delete model;
}
KoShapeContainerPrivate::KoShapeContainerPrivate(const KoShapeContainerPrivate &rhs, KoShapeContainer *q)
: KoShapePrivate(rhs, q),
shapeInterface(q),
KoShapeContainer::Private::Private(const KoShapeContainer::Private &rhs, KoShapeContainer *q)
: shapeInterface(q),
model(0)
{
}
KoShapeContainer::KoShapeContainer(KoShapeContainerModel *model)
: KoShape(new KoShapeContainerPrivate(this))
: KoShape(new KoShapeContainer::Private(this))
{
Q_D(KoShapeContainer);
d->model = model;
}
KoShapeContainer::KoShapeContainer(KoShapeContainerPrivate *dd)
KoShapeContainer::KoShapeContainer(KoShapeContainer::Private *dd)
: KoShape(dd)
{
Q_D(KoShapeContainer);
......@@ -195,7 +193,7 @@ KoShapeContainer::ShapeInterface::ShapeInterface(KoShapeContainer *_q)
void KoShapeContainer::ShapeInterface::addShape(KoShape *shape)
{
KoShapeContainerPrivate * const d = q->d_func();
KoShapeContainer::Private * const d = q->d_func();
KIS_SAFE_ASSERT_RECOVER_RETURN(shape);
......@@ -218,7 +216,7 @@ void KoShapeContainer::ShapeInterface::addShape(KoShape *shape)
void KoShapeContainer::ShapeInterface::removeShape(KoShape *shape)
{
KoShapeContainerPrivate * const d = q->d_func();
KoShapeContainer::Private * const d = q->d_func();
KIS_SAFE_ASSERT_RECOVER_RETURN(shape);
KIS_SAFE_ASSERT_RECOVER_RETURN(d->model);
......
......@@ -242,11 +242,9 @@ protected:
void shapeChanged(ChangeType type, KoShape *shape = 0) override;
/// constructor
KoShapeContainer(KoShapeContainerPrivate *);
private:
Q_DECLARE_PRIVATE(KoShapeContainer)
class Private;
QScopedPointer<Private> d;
};
#endif
......@@ -19,22 +19,23 @@
#ifndef KOSHAPECONTAINERPRIVATE_H
#define KOSHAPECONTAINERPRIVATE_H
#include "KoShape_p.h"
#include "KoShapeContainer.h"
#include "kritaflake_export.h"
#include <QSharedData>
class KoShapeContainerModel;
/**
* \internal used private d-pointer class for the \a KoShapeContainer class.
*/
class KRITAFLAKE_EXPORT KoShapeContainerPrivate : public KoShapePrivate
class KRITAFLAKE_EXPORT KoShapeContainer::Private : public QSharedData
{
public:
explicit KoShapeContainerPrivate(KoShapeContainer *q);
~KoShapeContainerPrivate() override;
explicit Private(KoShapeContainer *q);
~Private() override;
KoShapeContainerPrivate(const KoShapeContainerPrivate &rhs, KoShapeContainer *q);
Private(const Private &rhs, KoShapeContainer *q);
KoShapeContainer::ShapeInterface shapeInterface;
KoShapeContainerModel *model;
......
......@@ -147,7 +147,7 @@ KoShapeManager::KoShapeManager(KoCanvasBase *canvas)
void KoShapeManager::Private::unlinkFromShapesRecursively(const QList<KoShape*> &shapes)
{
Q_FOREACH (KoShape *shape, shapes) {
shape->priv()->removeShapeManager(q);
shape->removeShapeManager(q);
KoShapeContainer *container = dynamic_cast<KoShapeContainer*>(shape);
if (container) {
......@@ -182,7 +182,7 @@ void KoShapeManager::addShape(KoShape *shape, Repaint repaint)
{
if (d->shapes.contains(shape))
return;
shape->priv()->addShapeManager(this);
shape->addShapeManager(this);
d->shapes.append(shape);
if (d->shapeUsedInRenderingTree(shape)) {
......@@ -215,7 +215,7 @@ void KoShapeManager::remove(KoShape *shape)
detector.fireSignals();
shape->update();
shape->priv()->removeShapeManager(this);
shape->removeShapeManager(this);
d->selection->deselect(shape);
d->aggregate4update.remove(shape);
......
......@@ -26,6 +26,7 @@
#include <QPaintDevice>
#include <QTransform>
#include <QScopedPointer>
#include <QSharedData>
#include <KoClipMask.h>
......@@ -33,22 +34,13 @@ class KoBorder;
class KoShapeManager;
class KoShapePrivate
class KoShape::Private : public QSharedData
{
public:
explicit KoShapePrivate(KoShape *shape);
virtual ~KoShapePrivate();
explicit Private();
virtual ~Private();
explicit KoShapePrivate(const KoShapePrivate &rhs, KoShape *q);
/**
* Notify the shape that a change was done. To be used by inheriting shapes.
* @param type the change type
*/
void shapeChanged(KoShape::ChangeType type);
void addShapeManager(KoShapeManager *manager);
void removeShapeManager(KoShapeManager *manager);
explicit Private(const Private &rhs);
/**
* Fills the style stack and returns the value of the given style property (e.g fill, stroke).
......@@ -61,11 +53,10 @@ public:
// Loads the border style.
KoBorder *loadOdfBorder(KoShapeLoadingContext &context) const;
public:
// Members
KoShape *q_ptr; // Points the shape that owns this class.
mutable QSizeF size; // size in pt
QString shapeId;
QString name; ///< the shapes names
......@@ -113,7 +104,6 @@ public:
qreal textRunAroundThreshold;
KoShape::TextRunAroundContour textRunAroundContour;
public:
/// Connection point converters
......@@ -122,8 +112,6 @@ public:
/// Convert connection point position to shape coordinates, taking alignment into account
void convertToShapeCoordinates(KoConnectionPoint &point, const QSizeF &shapeSize) const;
Q_DECLARE_PUBLIC(KoShape)
};
#endif
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