Skip to content

Conversation

@chrchr-github
Copy link
Collaborator

No description provided.

@chrchr-github chrchr-github reopened this Nov 5, 2024
@chrchr-github
Copy link
Collaborator Author

I wonder if we can define Q_OBJECT as empty.

@chrchr-github
Copy link
Collaborator Author

I wonder if we can define Q_OBJECT as empty.

The current definition was added in #5533
virtual seems to be part of the original definition: https://stackoverflow.com/a/58483226

@firewave
Copy link
Collaborator

From the macro expansion view of my IDE.

Qt5:

public:
    static const QMetaObject staticMetaObject;
    virtual const QMetaObject* metaObject() const;
    virtual void* qt_metacast(const char*);
    virtual int qt_metacall(QMetaObject::Call, int, void**);

    static inline QString tr(const char* s, const char* c = nullptr, int n = -1)
    {
        return staticMetaObject.tr(s, c, n);
    }

    __attribute__ ((__deprecated__)) static inline QString trUtf8(const char* s, const char* c = nullptr, int n = -1)
    {
        return staticMetaObject.tr(s, c, n);
    }

private:
    __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject*, QMetaObject::Call, int, void**);

    struct QPrivateSignal
    {
    };

Qt6:

public:
    static const QMetaObject staticMetaObject;
    virtual const QMetaObject* metaObject() const;
    virtual void* qt_metacast(const char*);
    virtual int qt_metacall(QMetaObject::Call, int, void**);

    static inline QString tr(const char* s, const char* c = nullptr, int n = -1)
    {
        return staticMetaObject.tr(s, c, n);
    }

private:
    __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject*, QMetaObject::Call, int, void**);

    struct QPrivateSignal
    {
        explicit QPrivateSignal() = default;
    };

@firewave
Copy link
Collaborator

So we should add the virtual to those methods.

@chrchr-github chrchr-github merged commit 0003ad2 into danmar:main Dec 5, 2024
60 checks passed
@chrchr-github chrchr-github deleted the chr_13282 branch December 5, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants