Bug 343779 - metafunction.h needs to be updated for Qt 5
Summary: metafunction.h needs to be updated for Qt 5
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kross
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-04 17:16 UTC by Dmitry Shachnev
Modified: 2015-02-08 12:30 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.7


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Shachnev 2015-02-04 17:16:21 UTC
Kross' metafunction.h has the following code:

    // static metaobject
    staticMetaObject.d.superdata = &QObject::staticMetaObject;
    staticMetaObject.d.stringdata = m_stringData.data();
    staticMetaObject.d.data = m_data;
    staticMetaObject.d.extradata = 0;

Here, d is a struct that is different between Qt 4 and Qt 5. In Qt 4, it was declared as:

    struct { // private data
        const QMetaObject *superdata;
        const char *stringdata;
        const uint *data;
        const void *extradata;
    } d;

And in Qt 5 it is declared as:

    struct { // private data
        const QMetaObject *superdata;
        const QByteArrayData *stringdata;
        const uint *data;
        typedef void (*StaticMetacallFunction)(QObject *, QMetaObject::Call, int, void **);
        StaticMetacallFunction static_metacall;
        const QMetaObject * const *relatedMetaObjects;
        void *extradata; //reserved for future use
    } d;

As one can see, there are more fields there and they are of a different size. For example, assigning a char * to QByteArrayData * is not possible (one probably needs to use QByteArray's data_ptr() member function instead of just data()).

Reproducible: Always

Steps to Reproduce:
1. Build anything that uses metafunction.h.

Actual Results:  
The build fails.

Expected Results:  
The build should succeed.
Comment 1 David Faure 2015-02-08 12:30:39 UTC
Git commit f079cc63c0fb217dffe57ec300c94facc4ed1886 by David Faure.
Committed on 08/02/2015 at 12:28.
Pushed by dfaure into branch 'master'.

MetaFunction: rewrite the dynamic metaobject writing to make it work with Qt5.

With unittest.
FIXED-IN: 5.7
CHANGELOG: fix Kross::MetaFunction so it works with Qt5's metaobject system

M  +13   -0    CMakeLists.txt
M  +8    -0    autotests/CMakeLists.txt
A  +103  -0    autotests/metafunctiontest.cpp     [License: UNKNOWN]  *
M  +101  -31   src/core/metafunction.h

The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


http://commits.kde.org/kross/f079cc63c0fb217dffe57ec300c94facc4ed1886