Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. [已解决]“定制QML扩展插件”载入失败?求指教
Forum Updated to NodeBB v4.3 + New Features

[已解决]“定制QML扩展插件”载入失败?求指教

Scheduled Pinned Locked Moved Chinese
4 Posts 3 Posters 9.5k 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.
  • C Offline
    C Offline
    charles_yin
    wrote on last edited by
    #1

    我最近安装了Qt SDK 1.2.1 for windows,然后新建了一个定制QML扩展插件,把项目名,对象类名和URI都设为同一个名字,例如"Charles"。我用release方式生成,将生成的Charles.dll以及qmldir文件放在一个QtQuick UI项目下面,import进去,运行失败,出现如下输出:
    @Qml debugging is enabled. Only use this in a safe environment!
    file:///E:/Desktop/QT/UI/UI.qml:4:1: plugin cannot be loaded for module "": The plugin 'E:/Desktop/QT/UI/Charles.dll' uses incompatible Qt library. Expected build key "Windows mingw debug full-config", got "Windows mingw release full-config"
    import "./"
    @

    qml file(UI.qml):
    @import QtQuick 1.1
    import "./"
    Rectangle {
    width: 360
    height: 360
    Charles{
    id:logic
    }
    }
    @

    看来qmlviewer已经发现这插件,但是没法载入。
    后来我用debug方式生成了Charlesd.dll把它(以及对应的qmldir)放到UI项目里,这次qmlviewer能正常运行了,但是QtCreator的编辑器里面,qml文件里的Charles下面有红色波浪线,显示‘未知类型’。
    难道编辑器只识别release生成的插件而qmlviewer识别debug生成的插件?有点小晕。。

    ps.我把creator调用的那个qmlviewer拷贝出来,发现它依赖的是QtCored4.dll这种后面带‘d’的,那这个qmlviewer是不是debug方式生成的啊?

    我已经纠结这个问题几天了,不知各位有没有什么好法子,先谢谢了~

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

      Charles Yin还不会这个?
      另外一个Charles Yin来看看吧

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Charles
        wrote on last edited by
        #3

        都叫Charles没什么, 都叫Charles Yin, 那就不能不来认认亲了 :)

        debug版本的问题你自己已经发现了, 第二个问题,对于qtcreator来说, 要让它识别非内置的plugin中的qml类型, 你需要qmldump这个工具:
        http://doc.qt.nokia.com/qtcreator-2.3/creator-qml-modules-with-plugins.html

        1 Reply Last reply
        0
        • C Offline
          C Offline
          charles_yin
          wrote on last edited by
          #4

          哈哈真的很巧啊。很久没来论坛了,qmldump确实好用,当时我是装回Qt SDK 1.1.2貌似就不用qmldump了,。谢谢楼上的老师们:-)

          把解决方案记录了一下,见:http://iyinchao.cn/?p=41

          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