Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. IOS UIWebView in QML
Forum Updated to NodeBB v4.3 + New Features

IOS UIWebView in QML

Scheduled Pinned Locked Moved Mobile and Embedded
15 Posts 7 Posters 8.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    g00dnight
    wrote on last edited by
    #3

    Hello, many thanks for sharing the code. I'm not quite sure that I've understood your problem fully, though.

    The problem was about positioning this component according to QML x, y, width, height and anchors properties, right? If so, I was able to do it, you can check it "here":https://github.com/g00dnight/IOSWebView.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      khelkun
      wrote on last edited by
      #4

      [quote author="g00dnight" date="1408446341"]Hello, many thanks for sharing the code. I'm not quite sure that I've understood your problem fully, though.

      The problem was about positioning this component according to QML x, y, width, height and anchors properties, right? If so, I was able to do it, you can check it "here":https://github.com/g00dnight/IOSWebView.[/quote]

      Thanks a lot for the github g00dnight ! I'll give it a try in a few hours as soon as possible. And I'll edit this post to give a feedback.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        khelkun
        wrote on last edited by
        #5

        Hi again g00dnight and thank you so much and thanks to johnc's original post also. I tried your IOSWebView. First the issue was remaining : IOSWebView wasn't appearing in my the QML Window on my iPad 2.

        So I compared with another Qt sample (https://github.com/richardmg/qtdd13_qmlapp) which exposes the iOS Camera component (UIImagePickerController & ) as a QML Component. I noticed that this sample uses:
        @import QtQuick.Window 2.0@

        As my IOSWebView project was using:
        @import QtQuick.Window 2.1@

        So I changed for "QtQuick.Window 2.0" and it works! The root cause of my issue was really about the 2.1 version of QtQuick.Window element. Also my first post on this thread was a try with a Rectangle as the root QML element of my main.qml and this had no chance to work. All this is probably related to the following line in ioswebview.mm:
        @UIView pMainView = static_cast<UIView>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow("uiview", (QWindow*)window()));@

        So I was doing a wrong usage of the QML IOSWebView although it should probably work with "QtQuick.Window 2.1" and I don't know why it doesn't.

        I'm actually using Qt 5.3.1 on OSX 10.8.5.
        my main.cpp:
        @#include <QGuiApplication>
        #include <QQmlApplicationEngine>
        #include "ioswebview.h"

        int main(int argc, char *argv[])
        {
        QGuiApplication app(argc, argv);
        qmlRegisterType<IOSWebView>("IOSWebView", 1, 0, "IOSWebView");
        QQmlApplicationEngine engine;

        engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
        
        return app.exec(&#41;;
        

        }@

        my main.qml:
        @import QtQuick 2.2
        import QtQuick.Window 2.0
        import IOSWebView 1.0

        Window {
        visible: true

        IOSWebView {
            id:webview
            url: "http://www.google.fr"
            anchors.fill: parent
        }
        

        }@

        1 Reply Last reply
        0
        • G Offline
          G Offline
          guatedude2
          wrote on last edited by
          #6

          This is a great solution for the missing WebKit on IOS.

          Khelkun can you share the IOSWebView source in Git or similar?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #7

            Hi,

            There's now the "QtWebView":https://qt.gitorious.org/qt/qtwebview/ module that provides this

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • G Offline
              G Offline
              guatedude2
              wrote on last edited by
              #8

              [quote author="SGaist" date="1411945295"]Hi,

              There's now the "QtWebView":https://qt.gitorious.org/qt/qtwebview/ module that provides this[/quote]

              Cool thanks!

              1 Reply Last reply
              0
              • C Offline
                C Offline
                che1404
                wrote on last edited by
                #9

                Hi, I wanted to give QtWebView a try on iOS.
                I'm using the precompiled Qt 5.4 beta for iOS. Do you know how could I compile it and make it available for my app?

                Thanks!
                Robert.

                1 Reply Last reply
                0
                • V Offline
                  V Offline
                  Vincent007
                  wrote on last edited by
                  #10

                  git clone the repo, and then
                  qmake
                  make install
                  after that you should be able to build the example and deploy it via QtCreator.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    che1404
                    wrote on last edited by
                    #11

                    Thanks, I did exactly that and I'm getting a compile error:

                    In file included from qwebview_ios.mm:37:
                    ./qwebview_p.h:51:10: fatal error: 'QtWebView/qwebview_global.h' file not found
                    #include <QtWebView/qwebview_global.h>

                    Any ideas?
                    Thanks,
                    Robert.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      Are you on the dev branch ?

                      How did you proceed to compile it ? Did you install it ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        che1404
                        wrote on last edited by
                        #13

                        [quote author="SGaist" date="1413751591"]Are you on the dev branch ?[/quote]
                        Yes, that's the only branch in the repo.

                        [quote author="SGaist" date="1413751591"]How did you proceed to compile it ? Did you install it ?[/quote]

                        I followed the same steps that Vincent007 suggested:

                        • clone the git repo
                        • cd to the repo path
                        • run qmake
                        • run make install (got the compile error)

                        Thanks,
                        Robert.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #14

                          Personally I don't build in the sources since you might also want to build for e.g. Android and if something fails it's easier to just delete the faulty build and start from scratch.

                          Just tested an out of source build and got not problem. However you should rather do:

                          qmake

                          # make
                          # make install

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            che1404
                            wrote on last edited by
                            #15

                            Hi, I finally got it working.
                            I'm using the last 5.4 beta and I did an in source build. One for each platform (iOS/Android/OSX).
                            Thanks for your help!
                            Robert.

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved