Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-111471

Add colour pickers to QtQuick.Controls

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • Quick: Controls 2
    • None

    Description

      Currently we have a private SaturationLightnessPicker type in the dialogs module. It derives from QQuickAbstractColorPicker and just overrides one function:

      QColor colorAt(const QPointF &pos) override;
      

      I was thinking of exposing QQuickAbstractColorPicker as [Abstract]ColorPicker in QML, and making colorAt a QJSValue property, allowing the user to provide their own JS function so that they can easily implement their own colour picker in QML:

      Q_PROPERTY(QJSValue colorAt READ colorAtCallback WRITE setColorAtCallback NOTIFY colorAtCallbackChanged FINAL)
      

      By using different names for the getter/setter/signal, we can avoid conflict with the C++ function, which might become public later if we ever decide to make the templates C++ types public.

      Note that we can't do it in the same way as Item's containmentMask, because we just have a function, not a whole object.

      QQuickSaturationLightnessPicker could implement colorAt in C++ to avoid needing JS in the QML. The QML itself is more or less ready, we'd just need to provide implementations for each style (just the handle, from what I can see). However, we may need to rename it to make it more specific, since its logic is for a square picker. RectangularSaturationLightnessPicker? RectangularSLColorPicker? SLColorPickerRectangle?

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              mitch_curtis Mitch Curtis
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes