[Interest] Why is this not working? Assign direct to QML (through setContextProperty) works, as function doesn't.

Mark markg85 at gmail.com
Fri Nov 9 19:36:29 CET 2012


On Fri, Nov 9, 2012 at 2:14 PM, Mark <markg85 at gmail.com> wrote:
> On Fri, Nov 9, 2012 at 3:59 AM, Lincoln Ramsay <a1291762 at gmail.com> wrote:
>> On 09/11/12 12:56, Mark wrote:
>>> Ahh, i was really hoping for that to work! Sadly i was "welcomed" with
>>> this compiler error:
>>>
>>> pathmodel.o: In function `PathModel::PathModel(QObject*)':
>>> pathmodel.cpp:(.text+0x14): undefined reference to `vtable for PathModel'
>>
>> You need to run qmake to regenerate the Makefile because moc didn't run
>> (because the last time qmake ran, the Q_OBJECT macro wasn't there).
>>
>> --
>> Link
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>
> Hmm, i thought i did that. Anyway, after cleaning it up (thoroughly
> this time) it does compile, but it still gives "undefined" in QML when
> i call Util.pathModel() as in my initial example.
> The pathmodel.h looks like this now:
> #ifndef PATHMODEL_H
> #define PATHMODEL_H
>
> #include <QStringListModel>
>
> class PathModel : public QStringListModel
> {
>     Q_OBJECT
> public:
>     explicit PathModel(QObject *parent = 0);
> };
>
> Q_DECLARE_METATYPE(PathModel*)
> #endif // PATHMODEL_H
>
> Any other options i can try?
> Or is this perhaps a QML bug?

Reported this since i'm beginning to think that it's a bug
https://bugreports.qt-project.org/browse/QTBUG-27932



More information about the Interest mailing list