When I pass the code to Windows the icons are black and white
-
@serkan_tr said in When I pass the code to Windows the icons are black and white:
Put those icons in the resource file, then you can reference them with an identical path on every platform.
-
@serkan_tr said in When I pass the code to Windows the icons are black and white:
This part works correctly in Linux but not in Windows. The signal slot mechanism is not triggered in this part.
You post in General and Desktop, for Qt widget programs, but your screenshot is clearly QML. So which are you using?
Although I know nothing about QML, you have chosen to specify external files (rather than resource files) by path and have used a relative path, right? So what makes you think the
../.....
will reference the same file/directory under both OSes? Assuming QML treats them as relative to the current directory (does it?) what is that when you run the QML application on each platform and why do you assume they will be the same?You might consider earlier suggestion:
@artwaw said in When I pass the code to Windows the icons are black and white:Put those icons in the resource file, then you can reference them with an identical path on every platform.
I have no idea what "The signal slot mechanism is not triggered in this part" has to do with anything.
-
C Christian Ehrlicher moved this topic from General and Desktop on
-
... so put the images into a Qt resource file to make sure they are found.
-
@serkan_tr said in When I pass the code to Windows the icons are black and white:
@Pl45m4 shapes were formed. The shapes have no colors If the path was wrong then the shapes would not have formed.
UPDATE
Yes, I see what you mean.First do either of:
- Change to Qt resources. Does that make any difference?
- Change your existing paths to deliberately-non-existing, like
rubbish/assets/...
, so you are sure it is wrong. Does that make any difference?
If these produce same result, i.e. correct shapes but black & white, then it does indeed seem you have some trouble correctly rendering colored icons on the platform. I don't know why that should be. Check the properties of the
.png
files, do you have to install anything like a PNG library to make things work? Maybe try, say, a.jpg
or.gif
for one of them and see how that renders? -
S serkan_tr has marked this topic as solved on
-
In some Qt Quick Controls styles the icon are rendered in monochrome. Linux has a different default style than window.