jbagg / QtZeroConf

Qt wrapper class for ZeroConf libraries across various platforms.
Other
69 stars 51 forks source link

Add Qt6-Android support #63

Closed mariuszmaximus closed 6 months ago

mariuszmaximus commented 11 months ago

I try build QtZeroConf on Qt 6.6 for my Android phone

First problem QT += androidextras androidextras not exists in Qt6 https://www.qt.io/blog/qt-extras-modules-in-qt-6

I have problem with this functions: QtAndroid::androidActivity().object() QtAndroid::runOnAndroidThread(

mariuszmaximus commented 11 months ago

Work in progress: https://github.com/mariuszmaximus/QtZeroConf/tree/Qt6

Changes:

Todo: [1]

    nsdManager = QJniObject("qtzeroconf/QZeroConfNsdManager", "(JLandroid/content/Context;)V", reinterpret_cast<quint64>(this), QtAndroid::androidActivity().object());
    if (nsdManager.isValid()) {
        jclass objectClass = env->GetObjectClass(nsdManager.object<jobject>());
        env->RegisterNatives(objectClass, methods, sizeof(methods) / sizeof(methods[0]));
        env->DeleteLocalRef(objectClass);
    }

QtAndroid::androidActivity().object() I don't know what it is in Qt6

hancerli commented 6 months ago

Are you planning to submit a merge request any time soon?

jbagg commented 6 months ago

Did you finish your todo list?

hancerli commented 6 months ago

Seems like it's fixed here in androidnsd.cpp on line 56. Isn't that compiling @mariuszmaximus ?

jbagg commented 6 months ago

ok. I have not tried compiling it yet. Will do tonight. Is it ok if I re-order the commits and squash some together?

hancerli commented 6 months ago

Ah, I think QNativeInterface::QAndroidApplication::context() should be replaced with QNativeInterface::QAndroidApplication::context().object(). I'm testing with 6.7.0 btw.

jbagg commented 6 months ago

Qt6 Android support is now on master