Review Request 127678: Register metatypes that are used in Qt Designer files to eliminate warnings.

Christian David christian-david at web.de
Sun Jun 4 09:42:07 UTC 2017



> On April 22, 2016, 8:19 vorm., Christian David wrote:
> > Hi Mitch,
> > 
> > according to the [Qt Docu](http://doc.qt.io/qt-5/qmetatype.html#qRegisterMetaType-1) ```qRegisterMetaType``` is (only) needed under some circumstances:
> > 
> >     To use the type T in QVariant, using Q_DECLARE_METATYPE() is sufficient. To use the type T in queued signal and slot connections, qRegisterMetaType<T>() must be called before the first connection is established.
> >     
> > To prevent complicated issues if we use queued connections ourself in the future the ```qRegisterMetaType``` should go somewhere else. I think it should be ```mymoneymoney.cpp``` for ```MyMoneyMoney``` but I am unsure here.
> 
> Mitch Frazier wrote:
>     In terms of logically where it ought to go I don't know, I'm not that familiar with the organization of the code base.  However, in terms of satisfying the requirement that it "must be called before the first connection is established," making it a static variable initializer should be sufficient regardless of where it is placed.  Static initializers are run when the .so is loaded so they'll be executed before any "real" code gets run.
> 
> Christian David wrote:
>     In your case they are loaded in another (kind of unrelated) library than the library of the original objects. This violates the concept of enclosed units. To be specific; the ```qRegisterMetaType()``` call should be in the ```kmm_mymoney``` library. To suppress the warnings only they could go in the ```kmymoneywidgets``` library (but not ```kmm_widgets```). Your static initializer trick is cool.
> 
> Thomas Baumgart wrote:
>     Ping: Christian / Mitch what is the status on this one? Did you come to a conclusion what to do with the patch?

I recommend to use my recommended relocation of the ´´´qRegisterMetaType()´´´.


- Christian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/127678/#review94753
-----------------------------------------------------------


On April 22, 2016, 5:01 nachm., Mitch Frazier wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127678/
> -----------------------------------------------------------
> 
> (Updated April 22, 2016, 5:01 nachm.)
> 
> 
> Review request for KMymoney.
> 
> 
> Repository: kmymoney
> 
> 
> Description
> -------
> 
> Register metatypes to eliminate Qt Desinger warnings.
>     
> Registering metatypes for a type used in a widget eliminates
> the following types of warnings from Qt Designer on start up
> (displayed when designer is started from a console window):
>     
> QMetaProperty::read: Unable to handle unregistered datatype
>   '<class>' for property '<class>::<member>'
> 
> 
> Diffs
> -----
> 
>   kmymoney/widgets/kmymoneycurrencyselector.cpp 41be539 
>   kmymoney/widgets/kmymoneyedit.cpp ac79db7 
> 
> Diff: https://git.reviewboard.kde.org/r/127678/diff/
> 
> 
> Testing
> -------
> 
> Tested dialogs that use the data types.
> 
> 
> Thanks,
> 
> Mitch Frazier
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20170604/512b2f19/attachment-0001.html>


More information about the KMyMoney-devel mailing list