Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
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
- relates to
-
QTBUG-51167 Pickers: date, time, color...
- Open
-
QTBUG-87796 Implement non-native ColorDialog
- Closed