[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: how to put my document in the resourceProvider
From:       Stefan Nikolaus <stefan.nikolaus () kdemail ! net>
Date:       2007-06-25 14:42:52
Message-ID: 200706251642.55612.stefan.nikolaus () kdemail ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Monday 25 June 2007 16:33:53 Thomas Zander wrote:
> As one thing that I wanted to make easy for plugins to use, I wanted to
> put the current document instance in the KoCanvasResouceProvider.
> Unfortunately I can't seem to get anything to compile that puts a
> KWDocument* in a QVariant.
> Does anyone have a hint?
>
> Why can Krita place a layer in the QVariant just fine, if its 'wrapped' in
> a KisSharedPtr ? Is that a way to go?
>
> I have a similar problem with a QTextCursor. I'm guessing I need to create
> a struct with things like the document and selection etc which I then
> make possible to place in a QVariant.
>
> Any thoughts appreciated.

You may store it as a void pointer.

Example:
koffice/kspread/ui/View.cpp:1909:
    // Let the selection pointer become a canvas resource.
    QVariant variant;
    variant.setValue<void*>( d->selection );
    d->canvas->resourceProvider()->setResource( Canvas::Selection, variant );

koffice/kspread/chart/ChartDatabaseSelector.cpp:86:
    d->selection = 
static_cast<Selection*>(m_resourceProvider->resource(Canvas::Selection).value<void*>());

Regards,
Stefan

["signature.asc" (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic