How to assign image source during runtime in QML
-
Hi
In 5.1.0 QT version , if a QML project is created the following error is displayedIn my header file i included
"#include <QQmlContext>"
"Main.h:3: error: C1083: Cannot open include file: 'QQmlContext': No such file or directory"
-
Make sure you have added Qml module to your project file:
@
QT += qmlor, to have everything in:
QT += core gui qml quick
@ -
after adding "QT+=qml" in additional arguments of build steps , i am getting following error.
wrcMain.h:4: error: C1083: Cannot open include file: 'QQuickView': No such file or directory.
Actually i crated a QML project , still why these errors are coming, The same project i crated for 5.02 there was no error ?
-
How should I know? Clearly something is wrong, but I can't say what or where without more info.
Don't modify the build steps. Open your project file (usualy <yourProjectName>.pro) and add it there.
For this second error, obviously you need to add:
@
QT += quick
@ -
Thanks , i had added in .pro file
-
Hi
Now i would like to do transition between QML files . by having one part of screen as static .
1.How can i do the view/screen transiiton in QML
2.how will i create a static view that can be shown in all view. -
See "this":http://www.youtube.com/watch?v=cOViDcYWNCI.
-
Hi
How to perform animation for image(.png files)
I would like to make the image visibility to false after some duration -
Please, read the documentation, it is really well-written...
Here:
@
Image {
id: myImg
source: "somesource.png"
opacity: 1.0
NumberAnimation on opacity { duration: 2000 }
}
@Then simply change opacity to 0.0 somewhere in your code.
-
Hi
I actually tried to set the visible property after the number animation , but its not working.
@Image {
property int currentImage ; id: startup x: 46 y: 64 width: 223 height: 175 z: 5 rotation: 0 scale: 0.7 fillMode: Image.PreserveAspectCrop clip: true source: "images/start.png" visible: true opacity : 1.0 NumberAnimation on opacity { to: 0.0; duration: 4000 } NumberAnimation on scale { to: 1.3; duration: 4000 } Component.onCompleted:{ start_menu.visible = true} }
Image {
id: start_menu
source: "images/Setting.png"
anchors.bottom: stop.bottom
anchors.bottomMargin: -210
anchors.left : stop.down
anchors.leftMargin: 10
visible: false
}@I tried to display startup image to be displayed first and get invisible and then start_menu to be diaplayed
-
But both the images are getting displayed together and startup get invisible due to number animation
-
QML is declarative. It means that when you add a NumberAnimation it will only work then the property is changed. It is not imperative code like in C++ that tells the engine to run the animation. If you want it to run, you need to trigger it by running start(), or changing the value in question.
I don't have time now to explain fully, here is a piece of code that will work a bit, but it is not a full solution to your problem. Better use states to achieve it.
@
visible: true
opacity : 1.0
NumberAnimation on opacity { duration: 4000 }
NumberAnimation on scale { duration: 4000
onRunningChanged: {
if (!running)
start_menu.visible = true;
}
}
Component.onCompleted:{
opacity = 0.0; // this should start the animation
scale = 1.3;
}
@ -
Hi
Thanks for your replyI ma getting error as below
Cannot assign to non-existent property "onRunningChanged"
onRunningChanged: {