Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Best clickable widget for color swatch?

Best clickable widget for color swatch?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 5.9k Views
  • 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.
  • S Offline
    S Offline
    stephenju
    wrote on last edited by
    #1

    I am looking for a widget for display a color swatch. I need to set the
    color to display and receive a signal when it's clicked.

    I can't seem to find an existing QWidget that does both. Just want to
    make sure there's indeed no such canned one before I build my own.

    Thanks.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wladek
      wrote on last edited by
      #2

      Hi Stephen,

      How about "QColorDialog":http://doc.qt.nokia.com/4.7-snapshot/qcolordialog.html#details?
      Is this what you are lookinf for?

      Regards,
      wladek

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

        You mean you are looking for a label that displays the color and when clicked, displays the QColorDialog?

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • S Offline
          S Offline
          stephenju
          wrote on last edited by
          #4

          Yes, I need a color label that responds to clicks. And brings up the color picker dialog. Thanks.

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

            should not be hard to build on yourself
            just derive from QLabel, overwrite mouseClickEvent() and calls QColorDialog::getColor.
            Then call setbackgrounfdColor for the label.

            PS: all functions are just logical names, I did not look up the correct ones in the docs.

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • S Offline
              S Offline
              stephenju
              wrote on last edited by
              #6

              I am going to build my own. Just want to know I am not reinventing the wheel. :)

              Thanks.

              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