Thanx, that one was close, but still segfault:

        QSharedPointer<Item> pointer(item);

        QVariant var = QVariant::fromValue(pointer);

        list.append(var);




On Fri, Apr 5, 2013 at 1:33 PM, Conti Manuele <conti...@alice.it> wrote:

> Hi All,
> There is a problem in your code, actually I use this and work perfectly:
> Q_DECLARE_METATYPE(QSharedPointer<QPlcServerSocket::QExternalCommand>)
> qRegisterMetaType< QSharedPointer<QPlcServerSocket::QExternalCommand> >();
>
>
> Bye
>
> On 04/05/2013 12:27 PM, Samuel Gaist wrote:
> > He explains how to handle QObject * so a pointer to QObject instance,
> not a QObject instance.
> >
> > On 5 avr. 2013, at 12:22, Aekold Helbrass wrote:
> >
> >> So, it is absolutely impossible to use QObject-derived class with
> QVariant? I'm storing QList of pointers already, and I want to write that
> with QMetaProperty. The only thing that needs copy-constructor, in my
> understanding, is qRegisterMetaType invocation.
> >>
> >> I even read an article where guy explains how to get other types than
> one you're storing, so it looks like there is no problem in storing QObject
> in QVariant, but for some reason it doesn't work for me:
> >>
> http://steveire.wordpress.com/2011/03/16/implementing-qvariantqmetatype-features-with-template-tricks/
> >>
> >>
> >> On Fri, Apr 5, 2013 at 12:44 PM, André Somers <an...@familiesomers.nl>
> wrote:
> >> Op 5-4-2013 11:39, Sven Bergner schreef:
> >>> Hello,
> >>> you can use a custom type with QVariant by declaring it
> >>> using Q_DECLARE_METATYPE ( Type ).
> >>> Hope that helps.
> >>>
> >> It does not. That was already in the code posted in the opening post. As
> >> noted by others, the issue lies with trying to use a QObject derived
> >> class here.
> >>
> >> André
> >>
> >> --
> >> You like Qt?
> >> I am looking for collegues to join me at i-Optics!
> >>
> >> _______________________________________________
> >> Interest mailing list
> >> Interest@qt-project.org
> >> http://lists.qt-project.org/mailman/listinfo/interest
> >>
> >> _______________________________________________
> >> Interest mailing list
> >> Interest@qt-project.org
> >> http://lists.qt-project.org/mailman/listinfo/interest
> > _______________________________________________
> > Interest mailing list
> > Interest@qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> >
>
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to