Qt-interest Archive, December 2006
[Qt3] value-based containers and QObject
Message 1 in thread
Hello!
I have some shared class ( which holds pointer to data & ref-counter),
very similar to QDomNode and many others; and I use some value-based
containers to hold instances of this class.
The question is - what's the best way to implement signal-slot
mechanism in this class to interact with gui widgets? Provided I
sublcass it from QObject I would violate documentation rule to not use
QObject descendants in value-based containers.
--
[ signature omitted ]
Message 2 in thread
On 22.12.06 14:06:52, Dmitry Teslenko wrote:
> The question is - what's the best way to implement signal-slot
> mechanism in this class to interact with gui widgets? Provided I
> sublcass it from QObject I would violate documentation rule to not use
> QObject descendants in value-based containers.
You'd have to put pointers to the objects into the containers, instead
of the objects themselves.
Andreas
--
[ signature omitted ]
Message 3 in thread
At 05:06 AM 12/22/2006, Dmitry Teslenko wrote:
>Hello!
>I have some shared class ( which holds pointer to data & ref-counter),
>very similar to QDomNode and many others; and I use some value-based
>containers to hold instances of this class.
>
>The question is - what's the best way to implement signal-slot
>mechanism in this class to interact with gui widgets? Provided I
>sublcass it from QObject I would violate documentation rule to not use
>QObject descendants in value-based containers.
Why not put the QObject support in the data to which the class instance points, rather than the class? You would need some forwarding methods but that is just some extra typing.
--
[ signature omitted ]