|
Krita Source Code Documentation
|
A widget with several options to select an angle. More...
#include <KisAngleSelector.h>
Inheritance diagram for KisAngleSelector:Classes | |
| struct | Private |
Public Types | |
| enum | FlipOptionsMode { FlipOptionsMode_NoFlipOptions , FlipOptionsMode_MenuButton , FlipOptionsMode_Buttons , FlipOptionsMode_ContextMenu } |
| Options to select how the flip options should be presented. More... | |
Public Slots | |
| void | reset () |
| Sets the current angle to the reset angle. | |
| void | setAngle (qreal newAngle) |
| Sets the current angle. | |
Signals | |
| void | angleChanged (qreal angle) |
Public Member Functions | |
| qreal | angle () const |
| Gets the current angle. | |
| qreal | closestCoterminalAngleInRange (qreal angle, bool *ok=nullptr) const |
| Gets the closest coterminal angle to the provided angle that is in the range established. | |
| int | decimals () const |
| Gets the number of decimals (precision) used by the angle. | |
| void | flip (Qt::Orientations orientations) |
| Flips the angle horizontally, vertically, or both. | |
| FlipOptionsMode | flipOptionsMode () const |
| Gets the mode in which the flip options should be shown. | |
| KisAngleGauge::IncreasingDirection | increasingDirection () const |
| Gets the direction in which the angle increases in the angle gauge. | |
| bool | isUsingFlatSpinBox () const |
| Gets if the spin box is flat (no border or background) | |
| KisAngleSelector (QWidget *parent=0) | |
| Construct a new KisAngleSelector widget. | |
| qreal | maximum () const |
| Gets the maximum value for the angle. | |
| qreal | minimum () const |
| Gets the minimum value for the angle. | |
| QString | prefix () const |
| Gets the prefix shown in the spin box. | |
| qreal | resetAngle () const |
| Gets the angle that is used to reset the current angle. | |
| void | setDecimals (int newNumberOfDecimals) |
| Sets the number of decimals (precision) used by the angle. | |
| void | setFlipOptionsMode (FlipOptionsMode newMode) |
| Sets the mode in which the flip options should be shown. | |
| void | setIncreasingDirection (KisAngleGauge::IncreasingDirection newIncreasingDirection) |
| Sets the increasing direction in the angle gauge. | |
| void | setMaximum (qreal newMaximum) |
| Sets the maximum value for the angle. | |
| void | setMinimum (qreal newMinimum) |
| Sets the minimum value for the angle. | |
| void | setPrefix (const QString &newPrefix) |
| Sets the prefix shown in the spin box. | |
| void | setRange (qreal newMinimum, qreal newMaximum) |
| Sets the minimum and maximum values for the angle. | |
| void | setResetAngle (qreal newResetAngle) |
| Sets the angle that is used to reset the current angle. | |
| void | setSnapAngle (qreal newSnapAngle) |
| Sets the angle to which multiples the selected angle will snap. | |
| void | setWidgetsHeight (int newHeight) |
| Sets the common height of the widgets inside this angle selector. Use 0 to reset widgets to default height. | |
| void | setWrapping (bool newWrapping) |
| Sets if the angle should wrap pass the minimum or maximum angles. | |
| qreal | snapAngle () const |
| Gets the angle to which multiples the selected angle will snap. | |
| void | useFlatSpinBox (bool newUseFlatSpinBox) |
| Sets if the spin box should be flat. | |
| int | widgetsHeight () const |
| Gets the common height of the widgets inside this angle selector. | |
| bool | wrapping () const |
| Gets if the angle should wrap pass the minimum or maximum angles. | |
| ~KisAngleSelector () | |
Static Public Member Functions | |
| static qreal | closestCoterminalAngleInRange (qreal angle, qreal minimum, qreal maximum, bool *ok=nullptr) |
| Gets the closest coterminal angle to the provided angle that is in the range provided. | |
| static qreal | flipAngle (qreal angle, qreal minimum, qreal maximum, Qt::Orientations orientations, bool *ok=nullptr) |
| Flips an angle horizontally, vertically, or both. | |
| static qreal | flipAngle (qreal angle, Qt::Orientations orientations) |
| Flips an angle horizontally, vertically, or both. | |
Private Member Functions | |
| bool | event (QEvent *e) override |
| bool | eventFilter (QObject *o, QEvent *e) override |
Private Attributes | |
| const QScopedPointer< Private > | m_d |
A widget with several options to select an angle.
This widget is a combination of a KisAngleGauge and a spin box, along with some flipping options
Definition at line 60 of file KisAngleSelector.h.
Options to select how the flip options should be presented.
Definition at line 70 of file KisAngleSelector.h.
|
explicit |
Construct a new KisAngleSelector widget.
| parent | the parent widget |
Definition at line 194 of file KisAngleSelector.cpp.
References KisAngleGauge::angleChanged(), connect(), FlipOptionsMode_Buttons, KisIconUtils::loadIcon(), m_d, KisAngleSelector::Private::on_actionFlipHorizontally_triggered(), KisAngleSelector::Private::on_actionFlipHorizontallyAndVertically_triggered(), KisAngleSelector::Private::on_actionFlipVertically_triggered(), KisAngleSelector::Private::on_angleGauge_angleChanged(), KisAngleSelector::Private::on_spinBox_valueChanged(), reset(), setFlipOptionsMode(), and setWidgetsHeight().
| KisAngleSelector::~KisAngleSelector | ( | ) |
Definition at line 334 of file KisAngleSelector.cpp.
| qreal KisAngleSelector::angle | ( | ) | const |
Gets the current angle.
Definition at line 337 of file KisAngleSelector.cpp.
References m_d.
|
signal |
| qreal KisAngleSelector::closestCoterminalAngleInRange | ( | qreal | angle, |
| bool * | ok = nullptr ) const |
Gets the closest coterminal angle to the provided angle that is in the range established.
A coterminal angle to the provided angle is one that differs in size by an integer multiple of a turn (360 degrees)
| angle | The reference angle for which the function will try to find a coterminal angle | |
| [out] | ok | This parameter will be set to true if a coterminal angle exists in the specified range, or to false otherwise |
Definition at line 523 of file KisAngleSelector.cpp.
References angle(), closestCoterminalAngleInRange(), and m_d.
|
static |
Gets the closest coterminal angle to the provided angle that is in the range provided.
A coterminal angle to the provided angle is one that differs in size by an integer multiple of a turn (360 degrees)
| angle | The reference angle for which the function will try to find a coterminal angle | |
| minimum | The range's lower bound | |
| maximum | The range's upper bound | |
| [out] | ok | This parameter will be set to true if a coterminal angle exists in the provided range, or to false otherwise |
Definition at line 495 of file KisAngleSelector.cpp.
| int KisAngleSelector::decimals | ( | ) | const |
Gets the number of decimals (precision) used by the angle.
If you want to simulate integer angles, set it to 0. The default is 2.
Definition at line 352 of file KisAngleSelector.cpp.
References m_d.
|
overrideprivate |
Definition at line 579 of file KisAngleSelector.cpp.
References m_d.
|
overrideprivate |
Definition at line 595 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::flip | ( | Qt::Orientations | orientations | ) |
Flips the angle horizontally, vertically, or both.
This function will always try to set the closest angle to the stablished one that satisfies the flipping requirements
| orientations | Flags indicating in which directions the angle should be flipped |
Definition at line 570 of file KisAngleSelector.cpp.
References angle(), flipAngle(), maximum(), minimum(), and setAngle().
|
static |
Flips an angle horizontally, vertically, or both.
This function will always try to get the closest angle to the provided one that satisfies the flipping requirements
| angle | The angle to be flipped | |
| minimum | The lower bound of the valid range | |
| maximum | The upper bound of the valid range | |
| orientations | Flags indicating in which directions the angle should be flipped | |
| [out] | ok | This parameter will be set to true if the flipped angle is in the provided range, or to false otherwise |
Definition at line 565 of file KisAngleSelector.cpp.
References angle(), closestCoterminalAngleInRange(), flipAngle(), maximum(), and minimum().
|
static |
Flips an angle horizontally, vertically, or both.
This function will always try to get the closest angle to the provided one that satisfies the flipping requirements
| angle | The angle to be flipped |
| orientations | Flags indicating in which directions the angle should be flipped |
Definition at line 528 of file KisAngleSelector.cpp.
References angle().
| KisAngleSelector::FlipOptionsMode KisAngleSelector::flipOptionsMode | ( | ) | const |
Gets the mode in which the flip options should be shown.
The default is FlipOptions::FlipOptionsMode_Buttons
Definition at line 377 of file KisAngleSelector.cpp.
References m_d.
| KisAngleGauge::IncreasingDirection KisAngleSelector::increasingDirection | ( | ) | const |
Gets the direction in which the angle increases in the angle gauge.
Definition at line 387 of file KisAngleSelector.cpp.
References m_d.
| bool KisAngleSelector::isUsingFlatSpinBox | ( | ) | const |
Gets if the spin box is flat (no border or background)
Definition at line 392 of file KisAngleSelector.cpp.
References m_d.
| qreal KisAngleSelector::maximum | ( | ) | const |
Gets the maximum value for the angle.
The default is 360
Definition at line 357 of file KisAngleSelector.cpp.
References m_d.
| qreal KisAngleSelector::minimum | ( | ) | const |
Gets the minimum value for the angle.
The default is 0
Definition at line 362 of file KisAngleSelector.cpp.
References m_d.
| QString KisAngleSelector::prefix | ( | ) | const |
Gets the prefix shown in the spin box.
Definition at line 367 of file KisAngleSelector.cpp.
References m_d.
|
slot |
Sets the current angle to the reset angle.
Definition at line 490 of file KisAngleSelector.cpp.
References m_d.
| qreal KisAngleSelector::resetAngle | ( | ) | const |
Gets the angle that is used to reset the current angle.
This angle is used when the user double clicks on the widget
Definition at line 347 of file KisAngleSelector.cpp.
References m_d.
|
slot |
Sets the current angle.
| newAngle | the new angle |
Definition at line 397 of file KisAngleSelector.cpp.
References angleChanged(), m_d, and qFuzzyCompare().
| void KisAngleSelector::setDecimals | ( | int | newNumberOfDecimals | ) |
Sets the number of decimals (precision) used by the angle.
| newNumberOfDecimals | the new number of decimals used by the angle |
Definition at line 424 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setFlipOptionsMode | ( | FlipOptionsMode | newMode | ) |
Sets the mode in which the flip options should be shown.
| newMinimum | the new mode in which the flip options should be shown |
Definition at line 454 of file KisAngleSelector.cpp.
References FlipOptionsMode_Buttons, FlipOptionsMode_MenuButton, FlipOptionsMode_NoFlipOptions, and m_d.
| void KisAngleSelector::setIncreasingDirection | ( | KisAngleGauge::IncreasingDirection | newIncreasingDirection | ) |
Sets the increasing direction in the angle gauge.
| newIncreasingDirection | The new increasing direction |
Definition at line 480 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setMaximum | ( | qreal | newMaximum | ) |
Sets the maximum value for the angle.
| newMaximum | the new maximum value for the angle |
Definition at line 429 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setMinimum | ( | qreal | newMinimum | ) |
Sets the minimum value for the angle.
| newMinimum | the new minimum value for the angle |
Definition at line 434 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setPrefix | ( | const QString & | newPrefix | ) |
Sets the prefix shown in the spin box.
| newPrefix | the new prefix for the spin box |
Definition at line 444 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setRange | ( | qreal | newMinimum, |
| qreal | newMaximum ) |
Sets the minimum and maximum values for the angle.
| newMinimum | the new minimum value for the angle |
| newMaximum | the new maximum value for the angle |
Definition at line 439 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setResetAngle | ( | qreal | newResetAngle | ) |
Sets the angle that is used to reset the current angle.
| newResetAngle | the new angle that is used to reset the current angle |
Definition at line 419 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setSnapAngle | ( | qreal | newSnapAngle | ) |
Sets the angle to which multiples the selected angle will snap.
| newSnapAngle | the new angle to which multiples the selected angle will snap |
Definition at line 414 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setWidgetsHeight | ( | int | newHeight | ) |
Sets the common height of the widgets inside this angle selector. Use 0 to reset widgets to default height.
| newHeight | the new height of the internal widgets (angle gauge, spin box, etc.) |
Definition at line 471 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::setWrapping | ( | bool | newWrapping | ) |
Sets if the angle should wrap pass the minimum or maximum angles.
| newWrapping | true if the angle should wrap pass the minimum or maximum angles, false otherwise |
Definition at line 449 of file KisAngleSelector.cpp.
References m_d.
| qreal KisAngleSelector::snapAngle | ( | ) | const |
Gets the angle to which multiples the selected angle will snap.
The default snap angle is 15 degrees so the selected angle will snap to its multiples (0, 15, 30, 45, etc.)
Definition at line 342 of file KisAngleSelector.cpp.
References m_d.
| void KisAngleSelector::useFlatSpinBox | ( | bool | newUseFlatSpinBox | ) |
Sets if the spin box should be flat.
| newUseFlatSpinBox | True if the spin box should be flat, false otherwise |
Definition at line 485 of file KisAngleSelector.cpp.
References m_d.
| int KisAngleSelector::widgetsHeight | ( | ) | const |
Gets the common height of the widgets inside this angle selector.
Definition at line 382 of file KisAngleSelector.cpp.
References m_d.
| bool KisAngleSelector::wrapping | ( | ) | const |
Gets if the angle should wrap pass the minimum or maximum angles.
Definition at line 372 of file KisAngleSelector.cpp.
References m_d.
|
private |
Definition at line 366 of file KisAngleSelector.h.