[Qt-interest] [qt4.5-rc1] QVariant(void*) made private

J-P Nurmi jpnurmi at gmail.com
Sun Feb 15 18:39:35 CET 2009


On Sun, Feb 15, 2009 at 7:05 PM, Jeff Schiller <codedread at gmail.com> wrote:
>
> Hi J-P,
>
> Thanks for responding!
>
> On 2/15/09, J-P Nurmi <jpnurmi at gmail.com> wrote:
> > On Sun, Feb 15, 2009 at 5:33 PM, Jeff Schiller <codedread at gmail.com> wrote:
> > > I had the following code which worked fine in Qt 4.5 TP1 and Beta:
> > >
> > > SomeClass* somePersistentObject = ...;
> > > QAction* theAction = ...;
> > >
> > > theAction->setData(somePersistentObject);
> > >
> > > However, now that becomes an error in Qt RC1 because QVariant(void*)
> > > has been made private.
> > >
> > > What's the right way to pass an arbitrary pointer into a QVariant?
> >
> > Actually it was using the implicit QVariant(bool) constructor. The private
> > constructor was added to prevent this undesired behavior. You can still use
> > QVariant::fromValue().
>
> When I tried this, I received additional compiler errors stating that
> my SomeClass was not registered as a metatype.  I'm quite confused
> about metatypes, so a simple example would be great!

Add "Q_DECLARE_METATYPE(SomeClass*)" to the global namespace. See
http://doc.trolltech.com/4.4/qmetatype.html#Q_DECLARE_METATYPE for
more info.

>
> >
> > >
> > >
> > > Also, what's the reason that mingw was added to the Qt 4.5 release?
> > >
> > >
> >
> > Sorry, what do you mean?
> >
>
> When deploying an app using the Qt 4.5 Beta, I only needed to include
> QtCore4.dll, QtGui4.dll, ... However, when I installed the Qt 4.5 RC1,
> launching the app in Windows it complained that the mingw10.dll could
> not be found (I included this DLL in my deployment package, but I'm
> curious about what's going on).
>

Hmm, are you 100% sure? I'm not a MinGW export but I thought it has
been always necessary to deploy mingwm10.dll. It's even mentioned in
the deployment docs:
http://doc.trolltech.com/4.4/deployment-windows.html#additional-libraries

--
J-P Nurmi



More information about the Qt-interest-old mailing list