Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QT 4.7.4 SDK 1.1.3 error : QColor::setNamedColor: Unknown color name ’...’

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

Scheduled Pinned Locked Moved QML and Qt Quick
14 Posts 6 Posters 7.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goli
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • V Offline
      V Offline
      vsorokin
      wrote on last edited by
      #2

      Can you show code lines where does this errors happen?

      --
      Vasiliy

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goli
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • V Offline
          V Offline
          vsorokin
          wrote on last edited by
          #4

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

          --
          Vasiliy

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goli
            wrote on last edited by
            #5

            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...

            1 Reply Last reply
            0
            • V Offline
              V Offline
              vsorokin
              wrote on last edited by
              #6

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

              --
              Vasiliy

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goli
                wrote on last edited by
                #7

                no :(

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  tobias.hunger
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mbrasser
                    wrote on last edited by
                    #9

                    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

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      nightroad
                      wrote on last edited by
                      #10

                      Hello,

                      i'm getting same warnings too as;

                      QColor::setNamedColor: Unknown color name 'icons/settings2.png'

                      What should i do, ignore them or not ?

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        tmcguire
                        wrote on last edited by
                        #11

                        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:
                        @PropertyAction { target: foo; property: "visible"; value: "true" }@

                        The correct way is:
                        @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.

                        1 Reply Last reply
                        0
                        • N Offline
                          N Offline
                          nightroad
                          wrote on last edited by
                          #12

                          Hey,

                          I have a Button as like:
                          @
                          ToolButton {
                          enabled: false
                          id: btn_settings
                          caption: ""
                          icon: "icons/settings2.png"
                          }
                          @
                          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

                          1 Reply Last reply
                          0
                          • T Offline
                            T Offline
                            tmcguire
                            wrote on last edited by
                            #13

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

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              mbrasser
                              wrote on last edited by
                              #14

                              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

                              1 Reply Last reply
                              0

                              • Login

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • Users
                              • Groups
                              • Search
                              • Get Qt Extensions
                              • Unsolved