Commit f3c274f7 authored by Thorsten Zachmann's avatar Thorsten Zachmann

o make KoShape * a QMetaType so it can be used in QVariant

o make use of KoShape* being a QMetaType

svn path=/trunk/koffice/; revision=852613
parent 05771e16
......@@ -23,6 +23,7 @@
#include <QVariant>
#include <KoColor.h> // Zut, do we want this? It's convenient, but
// also makes flake dependent on pigment. (BSAR)
#include "KoShape.h"
class KoCanvasResourceProvider::Private
{
......@@ -81,7 +82,7 @@ void KoCanvasResourceProvider::setResource( int key, const KoID & id )
void KoCanvasResourceProvider::setResource( int key, KoShape* shape )
{
QVariant v;
v.setValue<void*>( shape );
v.setValue( shape );
setResource( key, v );
}
......@@ -111,7 +112,6 @@ void KoCanvasResourceProvider::setBackgroundColor( const KoColor & color )
//QVariant v;
//v.setValue( color );
setResource( KoCanvasResource::BackgroundColor, color );
}
KoColor KoCanvasResourceProvider::backgroundColor()
......@@ -124,6 +124,14 @@ KoID KoCanvasResourceProvider::koIDResource(int key)
return resource( key ).value<KoID>();
}
KoShape * KoCanvasResourceProvider::koShapeResource( int key )
{
if (! d->resources.contains(key))
return 0;
return resource( key ).value<KoShape *>();
}
void KoCanvasResourceProvider::setHandleRadius( int handleRadius )
{
// do not allow arbitrary small handles
......
......@@ -180,6 +180,12 @@ public:
*/
KoID koIDResource(int key);
/**
* Return the resource determined by param key as a pointer to a KoShape.
* @param key the indentifying key for the resource.
*/
KoShape * koShapeResource( int key );
/**
* Return the resource determined by param key as a QString .
* @param key the indentifying key for the resource.
......
......@@ -31,6 +31,7 @@
#include <QSet>
#include <QMap>
#include <QBrush>
#include <QMetaType>
#include <KoXmlReaderForward.h>
#include <KoSnapData.h>
......@@ -853,4 +854,6 @@ private:
Private * const d;
};
Q_DECLARE_METATYPE(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