草庐IT

xml - 找不到 qml XmlListModel 插件

coder 2024-06-29 原文

在我的项目中,我尝试使用 qml 中内置的 Xml 列表模块,但是当我编译到手机时,出现此错误

W/Qt      (20100): assets:/qml/FlickrDemo/main.qml:4 ((null)): assets:/qml/FlickrDemo/main.qml:4:1: module "QtQuick.XmlListModel" plugin "qmlxmllistmodelplugin" not found

任何帮助将不胜感激。 谢谢

更新

有了这两个建议的导入,我就在我的三星 Galaxy Note 2 和 vivo 上得到了这个输出

E/        ( 8142): Device driver API match
E/        ( 8142): Device driver API version: 23
E/        ( 8142): User space API version: 23 
E/        ( 8142): mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Fri Nov 29 14:18:37 KST 2013 
D/OpenGLRenderer( 8142): Enabling debug mode 0
W/Qt      ( 8142): assets:/qml/Demo2/main.qml:4 ((null)): assets:/qml/Demo2/main.qml:4:1: module "QtQuick.XmlListModel" plugin "qmlxmllistmodelplugin" not found 

更新 2

.pro文件

# Add more folders to ship with the application, here
folder_01.source = qml/Demo2
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01

# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =

QT += qml quick network positioning

# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp

# Installation path
# target.path =

QT += xmlpatterns xml

# Please do not modify the following two lines. Required for deployment.
include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
qtcAddDeployment()

主.qml

import QtQuick 2.0
import QtQuick.Controls.Styles 1.1
import QtQuick.Controls 1.1
import QtQuick.XmlListModel 2.0

Rectangle {
    id:screen
    height: 1280; width: 720

    XmlListModel{
        id:listmodel
        source:"http://api.flickr.com/services/feeds/photos_public.gne?tags=dogs"
        query:"/feed/entry"
        namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';"
        XmlRole{name:"img_title"; query: "title/string()"}
        XmlRole{name:"img_source";query:"link[@rel=\"alternate\"]/@href/string()"}
    }

    transitions:[
        Transition{
            NumberAnimation{
                target:layout
                property:"x"
                easing: Easing.OutSine
                duration:250
            }

        }
    ]
    states: [
        State {
            name: "view"
            PropertyChanges {
                target: layout
                x:-screen.width
            }
            PropertyChanges {
                target: btn_back
                opacity:1
            }
            PropertyChanges {
                target: te_search
                opacity:0
            }
            PropertyChanges {
                target: btn_search
                opacity:0
            }
        }
    ]

    Row{
        id:layout
        height:screen.height - te_search.height

        ListView {
            id: listview
            width:screen.width
            height:screen.height - te_search.height
            clip:true

            model: listmodel

            delegate: Item {
                width:parent.width
                height:80
                Image {
                    id:thumbnail
                    width:parent.height
                    height:parent.height
                    anchors.left:parent.left
                    //source:img_source
                    source:"http://t2.gstatic.com/images?q=tbn:ANd9GcTrUkD2AQtkUmcazQ0P9JCxJBn-_lMHiRI2XdiB5s17ho6dv3UP"
                    onSourceChanged: print("Your image source is : " + img_source)
                }
                Text{
                    id:txt_title
                    anchors.left:thumbnail.right
                    anchors.leftMargin: 5
                    anchors.right: txt_arrow.right
                    anchors.verticalCenter: parent.verticalCenter
                    font.pixelSize: 20
                    elide:Text.ElideMiddle
                    text:img_title
                }
                Text{
                    id:txt_arrow
                    anchors.right: parent.right
                    anchors.rightMargin: 10
                    anchors.verticalCenter: parent.verticalCenter
                    font.pixelSize: 25
                    text:">>"
                }
                MouseArea{
                    anchors.fill: parent
                    onClicked:{
                        console.log("clicked")
                        screen.state = "view"
                        console.log(img_source + " " + img_title)
                    }
                }
            }
        }
        Image{
            id:big_pic
            width:screen.width
            height: screen.width - te_search.height - 10
            fillMode:Image.PreserveAspectFit
            source: "http://www.hq.xinhuanet.com/photo/2013-02/04/114603916_21n.jpg"
            //source: img_source
        }
    }

    CTextInput{
        id:te_search
        y: 321
        height: 31
        anchors.right: btn_search.left
        anchors.left: screen.left
        anchors.leftMargin: 5
        anchors.bottom: screen.bottom
        anchors.bottomMargin: 5
        Behavior on opacity {NumberAnimation{}}
        text:"Search Pics"
    }

    Button {
        id: btn_search
        height: te_search.height
        x: 276
        y: 326
        text: qsTr("Search")
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 0
        Behavior on opacity {NumberAnimation{}}
        anchors.right: screen.right
        anchors.rightMargin: 5
    }

    Button {
        id: btn_back
        height: te_search.height
        x: 276
        y: 326
        opacity: 0
        text: qsTr("<< Back")
        Behavior on opacity {NumberAnimation{}}
        anchors.left: screen.left
        anchors.leftMargin: 5
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 0
        onClicked: screen.state = ""
    }

    Text{
        x: 0
        y: 0
        anchors.top: screen.top
        text:"Tester"
        horizontalAlignment: Text.AlignHCenter
        font.pixelSize: 70
    }
}

最佳答案

[更新]

尝试将XML 支持 添加到您的.pro 文件

 QT + = xmlpatterns xml

[更新 2] 也试试

Projects --->Android kit armeabi-v7 ---> run ---> Deploy configurations 

--->additional libraries --->add  

---> browse toQTpath/.../android_armv7/qml/QtQuick/XmlListModel 

并选择libqmlxmllistmodelplugin.so

关于xml - 找不到 qml XmlListModel 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22062760/

有关xml - 找不到 qml XmlListModel 插件的更多相关文章

  1. ruby - 如何每月在 Heroku 运行一次 Scheduler 插件? - 2

    在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/

  2. ruby-on-rails - 如何从 format.xml 中删除 <hash></hash> - 2

    我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为

  3. ruby-on-rails - 无法使用 Rails 3.2 创建插件? - 2

    我对最新版本的Rails有疑问。我创建了一个新应用程序(railsnewMyProject),但我没有脚本/生成,只有脚本/rails,当我输入ruby./script/railsgeneratepluginmy_plugin"Couldnotfindgeneratorplugin.".你知道如何生成插件模板吗?没有这个命令可以创建插件吗?PS:我正在使用Rails3.2.1和ruby​​1.8.7[universal-darwin11.0] 最佳答案 随着Rails3.2.0的发布,插件生成器已经被移除。查看变更日志here.现在

  4. ruby-on-rails - rbenv:从 RVM 移动到 rbenv 后,在 Jenkins 执行 shell 中找不到命令 - 2

    我从Ubuntu服务器上的RVM转移到rbenv。当我使用RVM时,使用bundle没有问题。转移到rbenv后,我在Jenkins的执行shell中收到“找不到命令”错误。我内爆并删除了RVM,并从~/.bashrc'中删除了所有与RVM相关的行。使用后我仍然收到此错误:rvmimploderm~/.rvm-rfrm~/.rvmrcgeminstallbundlerecho'exportPATH="$HOME/.rbenv/bin:$PATH"'>>~/.bashrcecho'eval"$(rbenvinit-)"'>>~/.bashrc.~/.bashrcrbenvversions

  5. ruby-on-rails - 找不到 gem railties (>= 0.a) (Gem::GemNotFoundException) - 2

    我已经看到了一些其他的问题,尝试了他们的建议,但没有一个对我有用。我已经使用Rails大约一年了,刚刚开始一个新的Rails项目,突然遇到了问题。我卸载并尝试重新安装所有Ruby和Rails。Ruby很好,但Rails不行。当我输入railss时,我得到了can'tfindgemrailties。我当前的Ruby版本是ruby2.2.2p95(2015-04-13修订版50295)[x86_64-darwin15],尽管我一直在尝试通过rbenv设置ruby​​2.3.0。如果我尝试rails-v查看我正在运行的版本,我会得到同样的错误。我使用的是MacOSXElCapitan版本10

  6. ruby-on-rails - 您希望看到哪些 Rails 插件? - 2

    您认为可以作为插件很好地存在于您的Rails应用程序中必须实现的哪些行为?您过去曾搜索过哪些插件功能但找不到?哪些现有的Rails插件可以改进或扩展,如何改进或扩展? 最佳答案 我希望在管理界面中看到一个引擎插件,它提供了应用程序中所有模型的仪表板摘要,以及可配置的事件图表。 关于ruby-on-rails-您希望看到哪些Rails插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questio

  7. 即使安装了 gem,Ruby 也找不到所需的库 - 2

    我花了几天时间尝试安装ruby​​1.9.2并让它与gems一起工作:-/我最终放弃了我的MacOSX10.6机器,下面是我的Ubuntu机器上的当前状态。任何建议将不胜感激!#rubytest.rb:29:in`require':nosuchfiletoload--mongo(LoadError)from:29:in`require'fromtest.rb:1:in`'#cattest.rbrequire'mongo'db=Mongo::Connection.new.db("mydb")#gemwhichmongo/usr/local/rvm/gems/ruby-1.9.2-p0/g

  8. ruby - Sinatra 找不到 View 目录 - 2

    我正在尝试以一种更类似于普通RubyGem结构的方式构建我的Sinatra应用程序。我有以下文件树:.├──app.rb├──config.ru├──Gemfile├──Gemfile.lock├──helpers│  ├──dbconfig.rb│  ├──functions.rb│  └──init.rb├──hidden│  └──Rakefile├──lib│  ├──admin.rb│  ├──api.rb│  ├──indexer.rb│  ├──init.rb│  └──magnet.rb├──models│  ├──init.rb│  ├──invite.rb│  ├─

  9. ruby - 在 SUSE 上找不到 Ruby 的头文件? - 2

    我正在尝试在SUSEEnterprise11SP3上安装compass。我得到以下信息。有什么想法吗?geminstallcompassBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingcompass:ERROR:Failedtobuildgemnativeextension./usr/bin/rubyextconf.rbmkmf.rbcan'tfindheaderfilesforrubyat/usr/lib64/ruby/ruby.hextconffailed,exitcode1Gemfileswi

  10. ruby - vagrant 从 github 安装插件 - 2

    我们正在使用Vagrant进行部署,我们最终希望将此集群部署在Rackspace上。vagrant-rackspace插件是一个自然的选择,但它有一些错误,这些错误未包含在最新的0.1.1版本中(notablythatvagrantprovisiondoesn'twork)。我已经在我的personalfork中解决了这个问题通过合并其他人的工作来对存储库进行改造。是否可以从github安装vagrant插件?显而易见的事情没有奏效:[unix]$vagrantplugininstallvagrant-rackspace--plugin-sourcehttps://github.com

随机推荐