|
lmms
Cross-platform music production software
|
#include <Knob.h>
Public Types | |
| enum class | LabelRendering { WidgetFont , LegacyFixedFontSize } |
| Determines how the label of the knob is rendered. More... | |
| Public Types inherited from lmms::gui::FloatModelEditorBase | |
| enum class | DirectionOfManipulation : bool { Vertical , Horizontal } |
Public Member Functions | |
| Knob (KnobType _knob_num, QWidget *_parent=nullptr, const QString &_name=QString()) | |
| Construct a Knob with the given style and no label. | |
| Knob (KnobType knobNum, const QString &labelText, QWidget *parent=nullptr, LabelRendering labelRendering=LabelRendering::WidgetFont, const QString &name=QString()) | |
| Construct a Knob with the given style and label text. | |
| Knob (KnobType knobNum, const QString &labelText, int labelPixelSize, QWidget *parent, const QString &name=QString()) | |
| Constructs a knob with a label font in the pixel size. | |
| Knob (QWidget *_parent=nullptr, const QString &_name=QString()) | |
| default ctor | |
| Knob (const Knob &other)=delete | |
| const QString & | getLabel () const |
| void | setLabel (const QString &txt) |
| void | setTotalAngle (float angle) |
| float | innerRadius () const |
| void | setInnerRadius (float r) |
| float | outerRadius () const |
| void | setOuterRadius (float r) |
| KnobType | knobNum () const |
| void | setknobNum (KnobType k) |
| QPointF | centerPoint () const |
| float | centerPointX () const |
| void | setCenterPointX (float c) |
| float | centerPointY () const |
| void | setCenterPointY (float c) |
| float | lineWidth () const |
| void | setLineWidth (float w) |
| QColor | outerColor () const |
| void | setOuterColor (const QColor &c) |
| QColor | textColor () const |
| void | setTextColor (const QColor &c) |
| Public Member Functions inherited from lmms::gui::FloatModelEditorBase | |
| FloatModelEditorBase (DirectionOfManipulation directionOfManipulation=DirectionOfManipulation::Vertical, QWidget *_parent=nullptr, const QString &_name=QString()) | |
| default ctor | |
| FloatModelEditorBase (const FloatModelEditorBase &other)=delete | |
| void | setHintText (const QString &txt_before, const QString &txt_after) |
| void | setToolTip (const QString &tip) |
| Sets the tooltip displayed when the mouse hovers over the control. | |
| QString | toolTip () const |
| void | unsetToolTip () |
| Public Member Functions inherited from lmms::gui::TypedModelView< FloatModel > | |
| TypedModelView (Model *model, QWidget *_this) | |
| FloatModel * | model () |
| const FloatModel * | model () const |
| Public Member Functions inherited from lmms::gui::AutomatableModelView | |
| AutomatableModelView (Model *model, QWidget *_this) | |
| ~AutomatableModelView () override=default | |
| AutomatableModel * | modelUntyped () |
| const AutomatableModel * | modelUntyped () const |
| void | setModel (Model *model, bool isOldModelValid=true) override |
| void | unsetModel () override |
| template<typename T> | |
| T | value () const |
| void | setDescription (const QString &desc) |
| void | setUnit (const QString &unit) |
| void | addDefaultActions (QMenu *menu) |
| void | setConversionFactor (float factor) |
| float | getConversionFactor () |
| Public Member Functions inherited from lmms::gui::ModelView | |
| ModelView (Model *model, QWidget *widget) | |
| virtual | ~ModelView () |
| Model * | model () |
| const Model * | model () const |
| template<class T> | |
| T * | castModel () |
| template<class T> | |
| const T * | castModel () const |
Protected Member Functions | |
| void | paintEvent (QPaintEvent *) override |
| void | changeEvent (QEvent *ev) override |
| bool | fixedFontSizeLabelRendering () const |
| void | setFixedFontSizeLabelRendering () |
| Protected Member Functions inherited from lmms::gui::FloatModelEditorBase | |
| void | contextMenuEvent (QContextMenuEvent *me) override |
| void | dragEnterEvent (QDragEnterEvent *dee) override |
| void | dropEvent (QDropEvent *de) override |
| void | focusOutEvent (QFocusEvent *fe) override |
| void | mousePressEvent (QMouseEvent *me) override |
| void | mouseReleaseEvent (QMouseEvent *me) override |
| void | mouseMoveEvent (QMouseEvent *me) override |
| void | mouseDoubleClickEvent (QMouseEvent *me) override |
| void | paintEvent (QPaintEvent *me) override |
| void | wheelEvent (QWheelEvent *me) override |
| void | enterEvent (QEnterEvent *) override |
| void | leaveEvent (QEvent *event) override |
| virtual float | getValue (const QPoint &p) |
| virtual QString | currentValueToText () |
| virtual std::optional< QString > | currentValueToTextUpdate () |
| virtual QString | getDynamicFloatingText (const QString ¤tValue) const |
| Provides the text to be shown in dynamic floating text. | |
| void | doConnections () override |
| void | showTextFloat (int msecBeforeDisplay, int msecDisplayTime, bool forceTextUpdate=false) |
| void | showTextFloat (bool forceTextUpdate=false) |
| const SimpleTextFloat & | textFloat () const |
| void | setPosition (const QPoint &p) |
| float | pageSize () const |
| DirectionOfManipulation | directionOfManipulation () const |
| InteractionType | currentInteraction () const |
| void | updateInteractionState (QEvent *event) |
| Updates m_interaction based on the event and current state. | |
| FloatingTextType | floatingTextType () const |
| Protected Member Functions inherited from lmms::gui::ModelView | |
| virtual void | modelChanged () |
| QWidget * | widget () |
Properties | |
| float | innerRadius |
| float | outerRadius |
| float | centerPointX |
| float | centerPointY |
| float | lineWidth |
| QColor | outerColor |
| QColor | lineActiveColor |
| QColor | lineInactiveColor |
| QColor | arcActiveColor |
| QColor | arcInactiveColor |
| KnobType | knobNum |
| QColor | textColor |
Private Member Functions | |
| void | initUi (const QString &_name) |
| to be called by ctors | |
| void | onKnobNumUpdated () |
| to be called when you updated m_knobNum | |
| QLineF | calculateLine (const QPointF &_mid, float _radius, float _innerRadius=1) const |
| void | drawKnob (QPainter *_p) |
| void | drawLabel (QPainter &p) |
| bool | updateAngle () |
| int | angleFromValue (float value, float minValue, float maxValue, float totalAngle) const |
| void | updateFixedSize () |
Private Attributes | |
| QString | m_label |
| bool | m_fixedFontSizeLabelRendering = false |
| std::unique_ptr< QPixmap > | m_knobPixmap |
| float | m_totalAngle |
| int | m_angle |
| QImage | m_cache |
| QPointF | m_centerPoint |
| float | m_innerRadius |
| float | m_outerRadius |
| float | m_lineWidth |
| QColor | m_outerColor |
| QColor | m_lineActiveColor |
| QColor | m_lineInactiveColor |
| QColor | m_arcActiveColor |
| QColor | m_arcInactiveColor |
| QColor | m_textColor |
| KnobType | m_knobNum |
Additional Inherited Members | |
| Signals inherited from lmms::gui::FloatModelEditorBase | |
| void | sliderPressed () |
| void | sliderReleased () |
| void | sliderMoved (float value) |
| Protected Types inherited from lmms::gui::FloatModelEditorBase | |
| enum class | InteractionType : std::uint8_t { None , MouseHover , MouseDrag , MouseWheel } |
| Types of user interaction with the control. More... | |
| enum class | FloatingTextType : std::uint8_t { None , Static , Dynamic } |
| Protected Attributes inherited from lmms::gui::FloatModelEditorBase | |
| QPoint | m_lastMousePos |
| mouse position in last mouseMoveEvent | |
| float | m_leftOver |
| Protected Attributes inherited from lmms::gui::AutomatableModelView | |
| QString | m_description |
| QString | m_unit |
| float | m_conversionFactor |
|
strong |
Determines how the label of the knob is rendered.
Labels can be rendered using the font that is set for the knob or using a font with a fixed size which is determined by SMALL_FONT_SIZE.
| Enumerator | |
|---|---|
| WidgetFont | Renders the label using the font that is set for the widget. The space that's needed for the label is determined using the font metrics of the knob's font. |
| LegacyFixedFontSize | Renders the labels in legacy mode. This uses a fixed font size and does not adhere to the font size that's set for the widget's font.
|
| lmms::gui::Knob::Knob | ( | KnobType | _knob_num, |
| QWidget * | _parent = nullptr, | ||
| const QString & | _name = QString() ) |
Construct a Knob with the given style and no label.
| _knob_num | Style of the knob |
| _parent | Parent widget |
| _name | Object name of the widget |
| lmms::gui::Knob::Knob | ( | KnobType | knobNum, |
| const QString & | labelText, | ||
| QWidget * | parent = nullptr, | ||
| LabelRendering | labelRendering = LabelRendering::WidgetFont, | ||
| const QString & | name = QString() ) |
Construct a Knob with the given style and label text.
| knobNum | Style of the knob |
| labelText | Text for the label |
| parent | Parent widget |
| labelRendering | Determines if the label uses the widget font or a font with a fixed size of 12 pixels (LegacyFixedFontSize). The default is to use the widget font. |
| name | Object name of the widget |
| lmms::gui::Knob::Knob | ( | KnobType | knobNum, |
| const QString & | labelText, | ||
| int | labelPixelSize, | ||
| QWidget * | parent, | ||
| const QString & | name = QString() ) |
Constructs a knob with a label font in the pixel size.
| knobNum | Style of the knob |
| labelText | Text for the label |
| labelPixelSize | Pixel size for the label |
| parent | Parent widget |
| name | Object name of the widget |
| lmms::gui::Knob::Knob | ( | QWidget * | _parent = nullptr, |
| const QString & | _name = QString() ) |
default ctor
|
delete |
|
inlineprivate |
|
private |
| QPointF lmms::gui::Knob::centerPoint | ( | ) | const |
| float lmms::gui::Knob::centerPointX | ( | ) | const |
| float lmms::gui::Knob::centerPointY | ( | ) | const |
|
overrideprotected |
|
private |
|
private |
|
inlineprotected |
Affects how the label of the knob is rendered.
The default mode returns false. The height of the label text is taken into account when a new fixed size is computed for the Knob. When the label text is painted the descent of the font is used to compute the base line. The default mode returns false.
Enabling fixed font size rendering mode leads to the following behavior:
| const QString & lmms::gui::Knob::getLabel | ( | ) | const |
|
private |
to be called by ctors
| float lmms::gui::Knob::innerRadius | ( | ) | const |
| KnobType lmms::gui::Knob::knobNum | ( | ) | const |
| float lmms::gui::Knob::lineWidth | ( | ) | const |
|
private |
to be called when you updated m_knobNum
| QColor lmms::gui::Knob::outerColor | ( | ) | const |
| float lmms::gui::Knob::outerRadius | ( | ) | const |
|
overrideprotected |
| void lmms::gui::Knob::setCenterPointX | ( | float | c | ) |
| void lmms::gui::Knob::setCenterPointY | ( | float | c | ) |
|
protected |
Set the button to legacy rendering mode which uses a fixed font size and that does not take the size of the widget's font into account.
This can be thought of as a legacy mode which reinstates the old behavior of the knob.
| void lmms::gui::Knob::setInnerRadius | ( | float | r | ) |
| void lmms::gui::Knob::setknobNum | ( | KnobType | k | ) |
| void lmms::gui::Knob::setLabel | ( | const QString & | txt | ) |
| void lmms::gui::Knob::setLineWidth | ( | float | w | ) |
| void lmms::gui::Knob::setOuterColor | ( | const QColor & | c | ) |
| void lmms::gui::Knob::setOuterRadius | ( | float | r | ) |
| void lmms::gui::Knob::setTextColor | ( | const QColor & | c | ) |
| void lmms::gui::Knob::setTotalAngle | ( | float | angle | ) |
| QColor lmms::gui::Knob::textColor | ( | ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| QColor lmms::gui::Knob::arcActiveColor |
| QColor lmms::gui::Knob::arcInactiveColor |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
| QColor lmms::gui::Knob::lineActiveColor |
| QColor lmms::gui::Knob::lineInactiveColor |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |