Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Integrating QML with C++ - Plugin problems [Solved]

Integrating QML with C++ - Plugin problems [Solved]

Scheduled Pinned Locked Moved QML and Qt Quick
12 Posts 3 Posters 4.5k Views
  • 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.
  • N Offline
    N Offline
    NickGlynn
    wrote on last edited by
    #1

    Hey there, I've been following the "developer slides":http://qt.nokia.com/developer/learning/online/training/materials/qt-essentials-qt-quick-edition on the site but I am having an issue with regards to standalone testing of plugins.

    Slide 55, Using Custom Types, says that if I have built the objects as ellipseplugin.dll and libellipseplugin.a in /plugins and have my qml and qmldir in /standalone then it should work.

    The qmldir is set to the relative location of ../plugins - in fact everything is as stated in the slide but I've tried running it with:
    @
    C:\Scratchpad\QtQuick Demos\8. qml-cpp-integration>qmlviewer -I ex-extension-plugin\plugins\ ex-extension-plugin\standalone\ellipse9s.qml
    @
    but the Debugging>Show Warnings window gives
    @
    file:///C:/Scratchpad/QtQuick Demos/8. qml-cpp-integration/ex-extension-plugin/standalone/ellipse9s.qml:6:5: Ellipse is not a type
    Ellipse {
    ^
    @

    Is this just broken on Windows or is there something I'm missing. I don't get a .so but a .a as mentioned in the slides so is it possible the default project builds a static library rather than the correct shared object?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dialingo
      wrote on last edited by
      #2

      Try to compile and run the example that comes with your Qt distribution:
      examples/declarative/cppextensions/plugins
      Don't miss to read the short README in the root folder.

      1 Reply Last reply
      0
      • N Offline
        N Offline
        NickGlynn
        wrote on last edited by
        #3

        I don't have examples/declarative/cppextensions, I have:

        C:\QtSDK\Examples\notificationexample
        C:\QtSDK\Examples\4.7<loads of examples>

        but even then the \declarative folder doesn't contain cppextensions:

        !http://i.imgur.com/7G1Sk.png(My samples)!

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dialingo
          wrote on last edited by
          #4

          I also can not find it in my QtSdk but look here:
          https://qt.gitorious.org/qt/qt/trees/4.7/examples/declarative/cppextensions/plugins

          1 Reply Last reply
          0
          • C Offline
            C Offline
            changsheng230
            wrote on last edited by
            #5

            Please refer to
            http://doc.qt.nokia.com/latest/declarative-cppextensions-plugins.html

            Chang Sheng
            常升

            1 Reply Last reply
            0
            • N Offline
              N Offline
              NickGlynn
              wrote on last edited by
              #6

              I think we're getting off topic here.

              The code accompanying the slides compiles fine - I just can't use it with QMLViewer so I wondered if the slides are wrong, the code is wrong (in which case, I need someone to contact to correct them ) or my configuration is wrong.

              Has anyone managed to run qmlviewer on the ellipse9s.qml example?

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dialingo
                wrote on last edited by
                #7

                Yes, I have just downloaded and compiled the example. No problem at all. It runs like a charm.
                I did not specify any path after qmlviewer. Make qml-cpp-integration/ex-extension-plugin/standalone your current directory and invoke
                qmlviewer ellipse9s.qml

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  NickGlynn
                  wrote on last edited by
                  #8

                  OK thanks for that - I guess something is wrong with my install on Windows. Going to reintall the Qt SDK :(

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dialingo
                    wrote on last edited by
                    #9

                    I did not test it under Windows though.

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      NickGlynn
                      wrote on last edited by
                      #10

                      I was aware it worked fine on Linux - that was the point of my posting, it didn't work under Windows so I wondered what was wrong. (hence the screenshot and the whole C:\ stuff).

                      Double sad face.

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        dialingo
                        wrote on last edited by
                        #11

                        Ok, my mistake.
                        Just repeated the same thing under Windows. First issue: To build it the path should not contain blanks. Second issue: It does not work under Windows. I also did not find a dll .

                        1 Reply Last reply
                        0
                        • N Offline
                          N Offline
                          NickGlynn
                          wrote on last edited by
                          #12

                          Boom sussed it. For me I changed QtCreator to build for mingw of the whole project, then launching a mingw command prompt from Programs>Qt SDK>Desktop>Qt 4.7.3 for Desktop (MingW).

                          I could then navigate to the directory and launch qmlviewer to view the app.

                          I figured that it must be a compilation/library configuration issue about 20 minutes after blowing away my Qt install and starting a new one and reading dialingo's mention of the .dll file...

                          Good times. I think I'm well on the way for my Qt Accreditation ;)

                          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