QSharedData - implicit sharing
Hi all!...I need an advise...as usual :)
I want to use QShareData...
I create my class "DataStorage" let's say...and it contains a QSharedDataPointer<data_type> to some data that I need to be referenced in different threads let's say.
So now...when I want the implicit sharing of referenced data make work...When I reference ...should I create only the references of QSharedDataPointer<data_type> or references of QSharedData class that contains this DataPointer to make the implicit sharing work ?
I mean when I send this data using signal...should I use reference to QSharedData inheriting class or just reference to QSharedDataPointer<data_type> of this class ?
Thanks a LOT! :)
Re: QSharedData - implicit sharing
QSharedData is meant to be used together with QSharedDataPointer.
See this example: http://doc.trolltech.com/4.3/qshared...r.html#details.
If you want it to work you should always use the QSharedData subclass, not the shared data pointer directly.
Re: QSharedData - implicit sharing
I know...I have implemented my code as it is shown in example you passed me...
What I was asking is HOW CAN I USE NOW IMPLEMENTED CLASSES TO SEND A DATA OVER SIGNAL AND MAKE REFERENCE COUNT WORKING ...
SHOULD I USE INHERITING QSHAREDATA CLASS CONTAING QSHAREDDATAPOINTER OR CAN I JUST SEND REFERENCE TO THIS POINTER TO MAKE REFERENCE COUNT WORKING ?
I THINK IT IS PRETTY CLEAR WHAT I WAS ASKING....
tHANKS
Re: QSharedData - implicit sharing
Well, the usage is obvious from the documentation, so I can't see what you can't understand.
Across signals and slots you should pass instances of your equivalent of the Employee class.
Maybe you can post the code, if this doesn't help you.
Re: QSharedData - implicit sharing
Thanks :)
that's what I needed to hear ...