September 13, 2011

goli goli
Lab Rat
111 posts

QT 4.7.4 SDK 1.1.3 error : QColor::setNamedColor: Unknown color name ’...’

 

i download the new version of SDK 1.1.3 and i tried to run an application that i write before (for the previous version of SDK), but then i get this error all the time:
QColor::setNamedColor: Unknown color name ‘true’
QColor::setNamedColor: Unknown color name ‘false’

why is this error appear ? and how can i fix this?

tnx

13 replies

September 13, 2011

Vass Vass
Ant Farmer
740 posts

Can you show code lines where does this errors happen?

 Signature 


Vasiliy

September 13, 2011

goli goli
Lab Rat
111 posts

it’s a big project, and it did work fine with the SDK 1.1.2.
i don’t know how to show the code.

September 13, 2011

Vass Vass
Ant Farmer
740 posts

If you do double click on error line on Build Issues pane – Qt creator open line with error automatically.

 Signature 


Vasiliy

September 13, 2011

goli goli
Lab Rat
111 posts

but the error is not appear at the build time/ compile time, it’s come at run time, when i run qml files.
i tried to search in google what are the reasons forr this error , but find nothing…

September 13, 2011

Vass Vass
Ant Farmer
740 posts

Ahh, I see, Well…
Do you anywhere in project has convertion from QColor to QVariant or vice versa?

 Signature 


Vasiliy

September 13, 2011

goli goli
Lab Rat
111 posts

no :(

September 13, 2011

Tobias Hunger Tobias Hunger
Mad Scientist
3383 posts

The errors seem to suggest that you are using “true” and “false” as color names… those are indeed not valid color names.

Looks like some boolean value is converted into a string to me. I’d recommend checking whatever you use to set the colors.

September 14, 2011

mbrasser mbrasser
Lab Rat
452 posts

Hi,

This is most likely due to some of the QML optimizations done for QtQuick 1.1 (in certain cases, when QML needs to convert from a string to a type, it will go through all it’s available “string convertors” (including string->color) and do a trial conversion). The warning has been removed for 4.8.

The extra warning shouldn’t impact the actual results, but if you’d like to get rid of the messages I’d suggest looking for any instances where you use the strings ‘true’/‘false’, and see if they can be converted to use true/false boolean values instead. (If you can find the exact code causing the issue there might be other workarounds as well)

Regards,
Michael

October 10, 2011

nightroad nightroad
Lab Rat
9 posts
Hello, i’m getting same warnings too as;

QColor::setNamedColor: Unknown color name ‘icons/settings2.png’

What should i do, ignore them or not ?

October 10, 2011

tmcguire tmcguire
Lab Rat
6 posts

In the case of “true” and “false”, simply search your source for “true” and “false” (with the quotes) and remove the quotes.

I had this happen with the following code:

  1. PropertyAction { target: foo; property: "visible"; value: "true" }

The correct way is:

  1. PropertyAction { target: foo; property: "visible"; value: true }

If you can’t figure out where the error is coming from, place a breakpoint in QColor::setNamedColor(), at the point where the warning is printed. The backtrace will tell you in which .qml file this happens, as some of the internal variables used in the declarative engine reveal the URL.

October 12, 2011

nightroad nightroad
Lab Rat
9 posts
Hey, I have a Button as like:
  1. ToolButton {
  2.    enabled: false
  3.    id: btn_settings
  4.    caption: ""
  5.    icon: "icons/settings2.png"  
  6. }
this is the unique “icons/settings2.png” where i’m using it. What i must to do for fixing that kind of Warnings.

Edit: Formatted code. please wrap code in @ tags; mlong

October 12, 2011

tmcguire tmcguire
Lab Rat
6 posts

nightroad, this depends on how your ToolButton component looks, there is nothing wrong with the code you posted.

October 14, 2011

mbrasser mbrasser
Lab Rat
452 posts

Hi nightroad,

What’s the property type for the icon property? I’m guessing variant, if you are getting this warning? If that is the case, changing the property type to string or url should fix the issue (assuming you are able to change the component definition).

Regards,
Michael

 
  ‹‹ WebView      [solved. thank you!] upper case ››

You must log in to post a reply. Not a member yet? Register here!