Unable to call another qml class
-
I am a self learn QML newbie.
Below is my code
currently i got 2 error i do not know how to resolve:
-Type Marquee unavailable
-module "QtQuick" version 1.0 is not installed.My understanding is qml filename is like a C++ class.
When i call it in another qml file, it is instantiated.
Why error Marquee unavailable?Another issue is i got problem importing QtQuick Particles 2.0 or any other modules. why?
@
--------------main.qml-----------------------import QtQuick 2.2
import QtQuick.Controls 1.1ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Hello World")Marquee{ //error1 width: 640 padding: 2 anchors.bottom: parent.bottom text: "i love you!" color: "black" textColor: "white" }
}
--------------Marquee.qml-----------------------import QtQuick 1.0 //error2
Rectangle {
width: parent.width
height: marqueeText.height + padding
clip: true// text to be displayed by the Marquee property string text // top/bottom text padding property int padding : 10 // the font size used by the Marquee property int fontSize : 20 // the scrolling animation interval property int interval : 100 // the text color property color textColor: "black" Text {
anchors.verticalCenter: parent.verticalCenter
id: marqueeText
font.pointSize: fontSize
color: textColor
text: parent.text
x: parent.width
}Timer {
interval: parent.interval
onTriggered: moveMarquee()
running: true
repeat: true
}function moveMarquee() {
if(marqueeText.x + marqueeText.width < 0)
{
marqueeText.x = marqueeText.parent.width;
}
marqueeText.x -= 10;
}}
@
-
Type Marquee is not available, because it contains an error - so the the engine cannot use it. Fix the error, and the component will work.
And the error is that you are mixing QtQuick 1 and 2, which are not compatible. Change the import in Marquee.qml to import QtQuick 2.2
-
[quote author="moeg687" date="1420740400"]Please mark as SOLVED. Thank you.[/quote]
Sorry, but you are not the original poster. Is that another account of yours?
-
Ah, ok then, thank you. Let's wait for OP response, then.
-
[quote author="sierdzio" date="1418806380"]Type Marquee is not available, because it contains an error - so the the engine cannot use it. Fix the error, and the component will work.
And the error is that you are mixing QtQuick 1 and 2, which are not compatible. Change the import in Marquee.qml to import QtQuick 2.2[/quote]
-I might be wrong but shouldn't he also import Marquee.qml(or the folder which contains the file)?-
Nevermind, tested it out, it's not necessary in some circumstances.
-
Current folder is imported by default in QML.