未找到 qml XmlListModel 插件 [英] qml XmlListModel plugin not found

查看:38
本文介绍了未找到 qml XmlListModel 插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my project I'm trying to use the Xml List Module built in to qml but when I compile to a phone I get this error

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

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

any help would be really appreciated. Thanks

更新

对于这两个估计的进口,我只是在我的三星 Galaxy Note 2 和 vivo 上得到了这个输出

with both of the sudgested imports I just get this output on both my samsung galaxy note 2 and 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()

main.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
    }
}

推荐答案

[UPDATED]

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

try to add XML support to your .pro file

 QT + = xmlpatterns xml

[更新 2]也试试

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

--->additional libraries --->add  

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

并选择libqmlxmllistmodelplugin.so

这篇关于未找到 qml XmlListModel 插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆