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. Problem with plugins
Forum Updated to NodeBB v4.3 + New Features

Problem with plugins

Scheduled Pinned Locked Moved QML and Qt Quick
20 Posts 6 Posters 13.8k 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.
  • X Offline
    X Offline
    xsacha
    wrote on last edited by
    #10

    Which part isn't working? Still the QML?

    How are you running the QML file? QMLViewer?

    Does your directory look like this?
    @
    .
    ..
    app.qml
    qmldir
    lib\elipseplugin.dll
    @
    P.S. Won't change anything but should be using (new notation):
    @import QtQuick 1.0@

    • Sacha
    1 Reply Last reply
    0
    • P Offline
      P Offline
      puelocesar
      wrote on last edited by
      #11

      Yes, the file structure is like you said, and I'm running with QMLViewer, but the plugin from the examples works fine with QMLViewer.

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xsacha
        wrote on last edited by
        #12

        Do you remember what you changed?
        You could try running a diff between your directory and the original plugin.

        • Sacha
        1 Reply Last reply
        0
        • B Offline
          B Offline
          baysmith
          wrote on last edited by
          #13

          You didn't provide the implementation of Elipse (elipse.cpp), but a common mistake (at least for me) is clearing the QGraphicsItem::ItemHasNoContents flag which is set by QDeclarativeItem.

          Works for me with the files above, plus these:

          main.qml
          @
          import Qt 4.7

          Rectangle {
          width: 100
          height: 62

          Elipse {
              anchors.fill: parent
              color: "red"
          }
          

          }
          @

          elipse.cpp
          @
          #include "elipse.h"

          #include <QtGui/QPainter>

          Elipse::Elipse(QDeclarativeItem *parent) :
          QDeclarativeItem(parent)
          {
          setFlag(QGraphicsItem::ItemHasNoContents, false);
          }

          Elipse::~Elipse() {}

          QColor Elipse::color() const { return m_color; }
          void Elipse::setColor(const QColor &color) { m_color = color; }

          QColor Elipse::border_color() const { return m_border_color; }
          void Elipse::setBorderColor(const QColor &border_color) { m_border_color = border_color; }

          int Elipse::border_size() const { return m_border_size; }
          void Elipse::setBorderSize(const int &border_size) { m_border_size = border_size; }

          void Elipse::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
          {
          painter->setPen(QPen(m_border_color, m_border_size));
          painter->setBrush(m_color);
          painter->drawEllipse(boundingRect());
          }
          @

          Nokia Certified Qt Specialist.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jalomic
            wrote on last edited by
            #14

            I have same trouble. Can anybody tell me stap-by-stap "howto" ?

            1 Reply Last reply
            0
            • R Offline
              R Offline
              remy_david
              wrote on last edited by
              #15

              I have the same troubles.
              For me the main problem is to understand how to correctly import the plugin to the application.

              If the plugin is in another location than the application, how do you tell the build system were to look ?
              Since I have several targets (simulator, device...) + release (debug, release...), I have different version of my plugin library in different folders. How does the build system makes the difference ?

              1 Reply Last reply
              0
              • X Offline
                X Offline
                xsacha
                wrote on last edited by
                #16

                In your .pro you can specify it depending on target and other such variables.

                symbian: { ...}
                win32: { ... }

                • Sacha
                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  remy_david
                  wrote on last edited by
                  #17

                  I know what you mean, however if I understand the docs correctly, importing a plugin does not involve the .pro at all
                  From the docs, the only thing you have to do is to add "import MyPlugin 1.0" at the top of the QML file in which you want to use the plugin.
                  http://doc.qt.nokia.com/latest/qdeclarativeextensionplugin.html

                  1 Reply Last reply
                  0
                  • X Offline
                    X Offline
                    xsacha
                    wrote on last edited by
                    #18

                    Your .pro is basically a shell script where you can configure which files are used. From the .pro you can effectively specify which plugin will be MyPlugin.

                    • Sacha
                    1 Reply Last reply
                    0
                    • R Offline
                      R Offline
                      remy_david
                      wrote on last edited by
                      #19

                      This is mentionned nowhere in the docs about using plugins, nor in the QMake doc. There don't seems to have any command related to QML Plugins in QMake.
                      Would you mind beeing a little bit more specific ?

                      1 Reply Last reply
                      0
                      • X Offline
                        X Offline
                        xsacha
                        wrote on last edited by
                        #20

                        In your .pro, you can specify source files to compile (eg. symbian: { ... HEADERS+=myplugin.h .. }, you can specify plugins to add (eg. symbian: { folder_01.source = symbian/plugin \ folder_01.target = symbian \ DEPLOYMENTFOLDERS = folder_01 }) and so on.

                        I mean that you can change the file structure with your .pro which will affect which plugin you import. I believe this is generally how multiple platforms are handled.

                        Otherwise, you can have defines for Q_WS_XX in source code or even entirely different QML files for each platform.
                        #ifdef Q_WS_S60
                        v.setMainQML("qrc:/symbian.qml");
                        #endif

                        There's many choices.

                        • Sacha
                        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