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. where is hsvHue()?

where is hsvHue()?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 665 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.
  • I Offline
    I Offline
    igor_stravinsky
    wrote on last edited by
    #1

    I'm trying to get Hue out of a color in Qt Quick Controls 2 5.11:

    MyObject{
         property color theColor:"white";
         value: {return theColor.hsvHue();}
    }
    
    This generates the error "TypeError: Property 'hsvHue' of object #ffffff is not a function"
    
    The documentation says: 
    "A color type has r, g, b and a properties that refer to the red, green, blue and alpha values of the color, respectively. Additionally it has hsvHue, hsvSaturation, hsvValue and hslHue, hslSaturation, hslLightness properties, which allow access to color values in HSV and HSL color models accordingly"
    
    What am I doing wrong here?
    
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You are trying to access a QColor method while you have color QML type.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • I Offline
        I Offline
        igor_stravinsky
        wrote on last edited by
        #3

        Doh!

        Is there a way to get hue from a qml color?

        And why is the bit of about hsvHue() listed on the color QML type page? It seems to imply that hsvHue will work with a qml color...

        1 Reply Last reply
        0
        • GrecKoG Online
          GrecKoG Online
          GrecKo
          Qt Champions 2018
          wrote on last edited by GrecKo
          #4

          @igor_stravinsky said in where is hsvHue()?:

          value: {return theColor.hsvHue();}

          As the doc and the error message say, it's a property, not a function.
          You can use it like so:
          value: theColor.hsvHue

          1 Reply Last reply
          3

          • Login

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