Problem with displaying proper graphics with qt creator
-
wrote on 21 May 2021, 17:42 last edited by
Background: I'm new to qt. After installing it I had a problem with form editor~ "qt emulation layer crashed". I tried all the ways that were provided over the net, but at that time nothing worked. however mysteriously the next day it started working.
Problem: the form editor does not show the image (icon) that it is supposed to show. however the output that occurs when i run it is the correct one.
form editor:
the output is working fine as this is exactly what i want. but the form editor seems to misbehave a bit. Qt creator only shows an error upon executing main.qml (the output runs perfectly fine though)
Error: QML Image: Cannot open: qrc:/qtquickplugin/images/template_image.png
Code:
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtGraphicalEffects 1.15Button{
id: btntoggle// CUSTOM PROPERTIES
property url btnIconSource: "../../images/svg_images/menu_icon.svg"
property color btnColorDefault: "#1c1d20"
property color btnColorMouseOver: "#23272E"
property color btnClicked: "#00a1f1"QtObject{
id: internal// PROPERTY TO CHANGE COLOR property var dynamicColor: if(btntoggle.down){ btntoggle.down ? btnClicked : btnColorDefault }else{ btntoggle.hovered ? btnColorMouseOver: btnColorDefault }
}
implicitWidth: 70
implicitHeight: 60background: Rectangle{
id:bgbtn
color: internal.dynamicColorImage { id: iconBtn source: btnIconSource anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter height: 25 width: 25 fillMode: Image.PreserveAspectFit } ColorOverlay{ anchors.fill: iconBtn source: iconBtn color: "#ffffff" antialiasing: false }
}
} -
wrote on 22 May 2021, 18:42 last edited by
Hi,
did you added image to qml.qrc file? -
Hi,
did you added image to qml.qrc file?wrote on 23 May 2021, 11:41 last edited by ARKDev2021@qtprogrammer123 Hi!
no I did not as it was not shown in the videos I was watching on the YouTube. -
Hi,
did you added image to qml.qrc file?wrote on 23 May 2021, 12:16 last edited by@qtprogrammer123 Though I have just noticed that the same error occurs in the editor of the youtuber too. But his works fine regardless of the error.
1/4