> On April 22, 2016, 8:19 a.m., 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.

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.


- 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 p.m., 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 p.m.)
> 
> 
> 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
> 
>

Reply via email to