|
Krita Source Code Documentation
|
This is a threshold slider that only has one handle. More...
#include <KisLevelsSlider.h>
Inheritance diagram for KisThresholdSlider:Public Slots | |
| void | reset (qreal newBlackPoint, qreal newWhitePoint) override |
| void | setBlackPoint (qreal newBlackPoint) override |
| Sets the black point. For this slider the black and the white points are always in the same position, so changing the black point will also change the white point and vice-versa. | |
| void | setHandlePosition (int handleIndex, qreal newPosition) override |
| Sets the black point. For this slider the black and the white points are always in the same position, so changing the black point will also change the white point and vice-versa. | |
| void | setThreshold (qreal newGamma) |
| Sets the gamma value. | |
| void | setWhitePoint (qreal newWhitePoint) override |
| Sets the white point. For this slider the black and the white points are always in the same position, so changing the black point will also change the white point and vice-versa. | |
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 | |
| void | thresholdChanged (qreal newThreshold) |
| Signal emitted when the threshold value changes. | |
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. | |
Public Member Functions | |
| KisThresholdSlider (QWidget *parent=nullptr) | |
| qreal | threshold () const |
| Get the gamma value. | |
| ~KisThresholdSlider () | |
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 () | |
Protected Member Functions | |
| void | paintBottomGradientMiddleSection (QImage &gradientImage, const QVector< Handle > &sortedHandles_) override |
| 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 | paintHandle (QPainter &painter, const QRect &rect, const Handle &handle) override |
| Override this function to paint custom handles. | |
Protected Member Functions inherited from KisInputLevelsSlider | |
| 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 |
| 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< Handle > | sortedHandles () 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. | |
Additional Inherited Members | |
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< Handle > | m_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} |
This is a threshold slider that only has one handle.
Definition at line 280 of file KisLevelsSlider.h.
| KisThresholdSlider::KisThresholdSlider | ( | QWidget * | parent = nullptr | ) |
Definition at line 596 of file KisLevelsSlider.cpp.
References KisLevelsSlider::m_constrainPositions.
| KisThresholdSlider::~KisThresholdSlider | ( | ) |
Definition at line 602 of file KisLevelsSlider.cpp.
|
overrideprotectedvirtual |
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.
Reimplemented from KisInputLevelsSlider.
Definition at line 648 of file KisLevelsSlider.cpp.
|
overrideprotectedvirtual |
Override this function to paint custom handles.
Reimplemented from KisLevelsSlider.
Definition at line 651 of file KisLevelsSlider.cpp.
References KisLevelsSlider::Handle::index, KisLevelsSlider::m_handles, KisLevelsSlider::m_hoveredHandle, KisLevelsSlider::m_selectedHandle, and KisLevelsSlider::paintHandle().
|
overrideslot |
Definition at line 626 of file KisLevelsSlider.cpp.
References KisInputLevelsSlider::blackPoint(), KisInputLevelsSlider::blackPointChanged(), KisLevelsSlider::handlePositionChanged(), KisLevelsSlider::m_handles, thresholdChanged(), and KisInputLevelsSlider::whitePointChanged().
|
overrideslot |
Sets the black point. For this slider the black and the white points are always in the same position, so changing the black point will also change the white point and vice-versa.
Definition at line 616 of file KisLevelsSlider.cpp.
References reset().
|
overrideslot |
Sets the black point. For this slider the black and the white points are always in the same position, so changing the black point will also change the white point and vice-versa.
Definition at line 610 of file KisLevelsSlider.cpp.
References KisLevelsSlider::m_handles, and reset().
|
slot |
|
overrideslot |
Sets the white point. For this slider the black and the white points are always in the same position, so changing the black point will also change the white point and vice-versa.
Definition at line 621 of file KisLevelsSlider.cpp.
References reset().
| qreal KisThresholdSlider::threshold | ( | ) | const |
Get the gamma value.
Definition at line 605 of file KisLevelsSlider.cpp.
References KisInputLevelsSlider::blackPoint().
|
signal |
Signal emitted when the threshold value changes.