11 #pragma warning(disable : 4996)
31 QWidget* parent =
nullptr,
32 Qt::Orientation orientation = Qt::Horizontal);
48 void paintEvent(QPaintEvent* e)
override;
59 :
public QList<ColorScaleElementSlider*> {
94 Qt::Orientation orientation,
96 QWidget* parent =
nullptr)
99 m_orientation(orientation),
104 return (m_orientation == Qt::Horizontal ? contentsRect().
width()
105 : contentsRect().
height()) -
138 QWidget* parent =
nullptr,
139 Qt::Orientation orientation = Qt::Horizontal);
150 void paintEvent(QPaintEvent* e)
override;
151 void mousePressEvent(QMouseEvent* e)
override;
161 QWidget* parent =
nullptr,
162 Qt::Orientation orientation = Qt::Horizontal);
165 void select(
int index,
bool silent =
false);
174 void updateSliderPos(
int index);
177 void updateAllSlidersPos();
189 void mousePressEvent(QMouseEvent* e)
override;
190 void mouseMoveEvent(QMouseEvent* e)
override;
192 void mouseDoubleClickEvent(QMouseEvent* e)
override;
193 void resizeEvent(QResizeEvent* e)
override;
203 QWidget* parent =
nullptr,
204 Qt::Orientation orientation = Qt::Horizontal);
214 void paintEvent(QPaintEvent* e)
override;
231 Qt::Orientation orientation = Qt::Horizontal);
238 return (m_sliders ? m_sliders->size() : 0);
243 return m_sliders ? m_sliders->at(index) :
nullptr;
247 void setStepColor(
int index, QColor
color);
250 void setStepRelativePosition(
int index,
double relativePos);
254 return m_sliders ? m_sliders->selected() : -1;
258 void setSelectedStepIndex(
int index,
bool silent =
false);
263 void deleteStep(
int index);
272 void showLabels(
bool state);
275 void setLabelColor(QColor
color);
278 void setLabelPrecision(
int precision);
294 void onPointClicked(
double relativePos);
297 void onSliderModified(
int sliderIndex);
300 void onSliderSelected(
int sliderIndex);
Color scale element as a widget.
Qt::Orientation m_orientation
Widget orientation.
static bool IsSmaller(const ColorScaleElementSlider *e1, const ColorScaleElementSlider *e2)
Comparison operator between two (pointers on) color scale elements.
bool m_selected
Selection state.
void setSelected(bool state)
Sets selection state.
bool isSelected() const
Returns selection state.
Set of color scale elements (widgets)
Color scale element: one value + one color.
double getRelativePos() const
Returns step position (relative to scale boundaries)
QSharedPointer< ccColorScale > Shared
Shared pointer type.
int indexOf(T *arr, int n, const T &what)
constexpr Rgb black(0, 0, 0)