Krita Source Code Documentation
Loading...
Searching...
No Matches
KisOutputLevelsSlider Class Reference

This is a simple output levels slider. It is basically the same as KisInputLevelsSlider but the handles are not constrained and can move freely. More...

#include <KisLevelsSlider.h>

+ Inheritance diagram for KisOutputLevelsSlider:

Public Member Functions

 KisOutputLevelsSlider (QWidget *parent=nullptr)
 
 ~KisOutputLevelsSlider ()
 
- Public Member Functions inherited from KisInputLevelsSlider
qreal blackPoint () const
 Get the normalized black point.
 
 KisInputLevelsSlider (QWidget *parent=nullptr)
 
qreal whitePoint () const
 Get the normalized white point.
 
 ~KisInputLevelsSlider ()
 
- Public Member Functions inherited from KisLevelsSlider
virtual QRect gradientRect () const
 Gets the rect where the gradient will be painted.
 
QColor handleColor (int handleIndex) const
 Gets the color associated with a given handle.
 
qreal handlePosition (int handleIndex) const
 Gets the normalized position of a given handle.
 
 KisLevelsSlider (QWidget *parent)
 
QSize minimumSizeHint () const override
 
QSize sizeHint () const override
 
 ~KisLevelsSlider ()
 

Additional Inherited Members

- Public Slots inherited from KisInputLevelsSlider
virtual void reset (qreal newBlackPoint, qreal newWhitePoint)
 Sometimes you want to set the range to a totally different place, but the new black point can be greater than the old white point so the new black point position will be constrained to the old white position. This function allows to set both values at once to prevent that undesirable effect. Use it when the widget has to show new values, for a different set of levels parameters for example.
 
virtual void setBlackPoint (qreal newBlackPoint)
 Sets the black point.
 
virtual void setWhitePoint (qreal newWhitePoint)
 Sets the white point.
 
- Public Slots inherited from KisLevelsSlider
virtual void setHandleColor (int handleIndex, const QColor &newColor)
 Sets the color associated with the given handle.
 
virtual void setHandlePosition (int handleIndex, qreal newPosition)
 Sets the normalized position of the given handle.
 
- Signals inherited from KisInputLevelsSlider
void blackPointChanged (qreal newBlackPoint)
 Signal emitted when the black point changes.
 
void whitePointChanged (qreal newWhitePoint)
 Signal emitted when the white point changes.
 
- Signals inherited from KisLevelsSlider
void handleColorChanged (int handleIndex, const QColor &color)
 Signal emitted when the color associated with a handle changes.
 
void handlePositionChanged (int handleIndex, qreal position)
 Signal emitted when the position of a handle changes.
 
- Protected Member Functions inherited from KisInputLevelsSlider
virtual void paintBottomGradientMiddleSection (QImage &gradientImage, const QVector< Handle > &sortedHandles_)
 This is used to fill the space between the tho handles in the bottom bar of the "gradient". It just paints a linear gradient that goes from black (first handle's color) to white (last handle's color). Derived classes can override this function if they only want to change that area. "gradientImage" is a 256x1px image.
 
void paintGradient (QPainter &painter, const QRect &rect) override
 Custom gradient painter. This paints two bars in the gradient rect, one on top of the other. The top one shows a simple black to white (more exactly, color of the first handle to color of the last handle) linear gradient. The bottom one shows black (first handle's color) from the right side of the rect to the black point, and white (last handle's color) from the white point to the left side of the rect. In the middle of the two handles, the "paintBottomGradientMiddleSection" is used to fill the bar.
 
- Protected Member Functions inherited from KisLevelsSlider
int closestHandleToPosition (qreal position) const
 Given a normalized position, this function returns the closest handle to that position.
 
int closestHandleToX (int x) const
 Given a widget-relative x position, this function returns the closest handle to that position.
 
void handleIncrementInput (int direction, Qt::KeyboardModifiers modifiers)
 
void keyPressEvent (QKeyEvent *e) override
 
void leaveEvent (QEvent *e) override
 
void mouseMoveEvent (QMouseEvent *e) override
 
void mousePressEvent (QMouseEvent *e) override
 
void paintEvent (QPaintEvent *e) override
 
virtual void paintHandle (QPainter &painter, const QRect &rect, const Handle &handle)
 Override this function to paint custom handles.
 
qreal positionFromX (int x) const
 Given a widget-relative x position in pixels, this function returns the normalized position relative to the gradient rect.
 
QVector< HandlesortedHandles () const
 Regardless the index of a handle, they can be unordered in terms of the position. This returns a sorted vector with the handles that have a smaller position first. If two handles have the same position then the index is used for sorting.
 
void wheelEvent (QWheelEvent *e) override
 
int xFromPosition (qreal position) const
 Given a gradient rect relative position, this function returns the x position in pixels relative to the widget.
 
- Protected Attributes inherited from KisLevelsSlider
int m_constrainPositions
 This variable indicates if the handles can have unordered positions. If it is set to true then the user won't be able to move a handle pass another one. If it is set to false then the ser will be able to move the handles freely.
 
QVector< Handlem_handles
 The collection of handles.
 
int m_hoveredHandle
 
int m_selectedHandle
 
- Static Protected Attributes inherited from KisLevelsSlider
static constexpr int handleHeight {11}
 
static constexpr int handleWidth {11}
 
static constexpr qreal minimumSpaceBetweenHandles {0.001}
 
static constexpr qreal normalPositionIncrement {0.01}
 
static constexpr qreal slowPositionIncrement {0.001}
 

Detailed Description

This is a simple output levels slider. It is basically the same as KisInputLevelsSlider but the handles are not constrained and can move freely.

Definition at line 268 of file KisLevelsSlider.h.

Constructor & Destructor Documentation

◆ KisOutputLevelsSlider()

KisOutputLevelsSlider::KisOutputLevelsSlider ( QWidget * parent = nullptr)

Definition at line 586 of file KisLevelsSlider.cpp.

587 : KisInputLevelsSlider(parent)
588{
589 m_constrainPositions = false;
590}
KisInputLevelsSlider(QWidget *parent=nullptr)
int m_constrainPositions
This variable indicates if the handles can have unordered positions. If it is set to true then the us...

References KisLevelsSlider::m_constrainPositions.

◆ ~KisOutputLevelsSlider()

KisOutputLevelsSlider::~KisOutputLevelsSlider ( )

Definition at line 592 of file KisLevelsSlider.cpp.

593{}

The documentation for this class was generated from the following files: