Qt World Summit: Submit your Presentation

How to create a custom native OSX webkit widget with Objective C?

  • Using Qt 5.5, how does one create a custom widget? See, I'd like to use the native webkit that's part of the OSX operating system. I've been teaching myself Objective C this week and pretty much have that down now -- does it require that I do something in Objective C?

    What I'd like to do is create a custom widget that uses the native webkit that's part of OSX, and then have it embed a Qt/C++ object into the Javascript so that for instance when I click a button in Webkit, my Javascript can call some class method in my Qt/C++.

    I'm aware of the tech preview in Qt5. However, I found that it was buggy and not ready for primetime. When you start adding form controls in the HTML on it, they show up all wonky.

    Another route is that I could create the application in Objective C + the webkit widget for it, and then somehow bridge that to call compiled Qt/C++ dylibs through the Javascript, if that's possible.

  • Lifetime Qt Champion


    QMacNativeWidget might be of interest.

    Hope it helps

  • @SGaist LOL!!! Now why didn't I know about this sooner? My project had grown to 30MB, zipped, and 40MB unzipped, because I was using Qt's version of Webkit.

    I'll give this a shot and report back.

  • Hi @maximo, did you have success with the MacNativeWidget and didi it reach your requirements.