Grantlee problems

Dirk Hohndel dirk at hohndel.org
Wed Jul 29 06:59:11 PDT 2015


> On Jul 29, 2015, at 2:05 AM, Robert Helling <helling at lmu.de> wrote:
> 
> Hi,
> 
> as I said already on IRC, somehow, on my Mac, grantlee does not fill in the template (no dive data is entered). In addition I get some error messages on the console which do not tell me a lot and also the data types that come with grantlee are also not easy for me to look into with the debugger. Here is what happens in detail. I am single stepping through printer.cpp.
> 
> In line 87 	Grantlee::Template t = m_engine->loadByName(PrintOptions->p_template);
> 
> This produces the error
> 
> QObject: Cannot create children for a parent that is in a different thread.
> (Parent is Grantlee::Parser(0x7fff5fbfb8f8), parent's thread is QThread(0x104d2da60), current thread is QThread(0x11d4b9240)
> QObject: Cannot create children for a parent that is in a different thread.
> (Parent is Grantlee::Parser(0x7fff5fbfb8f8), parent's thread is QThread(0x104d2da60), current thread is QThread(0x11d4b9240)
> QObject::setParent: Cannot set parent, new parent is in a different thread

My guess is that this is what really causes the problems. Somehow the template
ends up not being loaded correctly or not being connected correctly.

One thing to do here is to compile grantlee with debugging and step into the calls.

        m_engine->addTemplateLoader(m_templateLoader);

in line 60 of templatelayout.cpp appears to succeed. Then what's different with the 
loadByName() call in line 87?

> I don’t know how threads enter here but maybe this is the progress bar? I had a similar error before when trying to show a modal dialog from a thread that was not the main thread. But this is how far my experience takes me.
> 
> Then a bit later, in line 92 
> 	htmlContent = t->render(&c);
> 
> I get the error 
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype
> Don't know how to handle metatype 

So this means it can't figure out how to handle the parts in the template that
are our types (so things like "{{ print_options.grayscale }};")
The only place this message is printed is in templates/lib/customtyperegistry.cpp
in line 56
    if ( !types.contains( id ) ) {
      qWarning() << "Don't know how to handle metatype" << QMetaType::typeName( id );
so put a breakpoint there and try to figure out what's going wrong.

/D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150729/93a5339d/attachment-0001.html>


More information about the subsurface mailing list