3ds Max C++ API Reference
QmaxDoubleSpinBox Class Reference

3ds Max's version of a Qt QDoubleSpinBox. More...

#include <QmaxSpinBox.h>

+ Inheritance diagram for QmaxDoubleSpinBox:

Public Slots

void setResetValue (double resetValue)
 Changes the reset value of this component. More...
 
void setAnimationKeyBrackets (bool animationKeyBrackets=true)
 Sets whether the animation key brackets around the component should be shown. More...
 
void setIndeterminate (bool indeterminate)
 Sets whether the control should be shown in an indeterministic state. More...
 
void setVisibleDigits (int visibleDigits)
 Sets the visibleDigits property. More...
 
void reset ()
 Resets this component's value to its resetValue. More...
 

Signals

void interactiveChanged (bool interactive, bool userCancelled=false)
 Gets emitted as soon the component's interactive mode changes. More...
 
void contextMenuCustomization (QMenu &contextMenu)
 Gets emitted when the context menu is shown. More...
 
void visibleDigitsChanged (int visibleDigits)
 Gets emitted when the visibleDigits have been changed. More...
 

Public Member Functions

 QmaxDoubleSpinBox (QWidget *parent=nullptr)
 
virtual ~QmaxDoubleSpinBox ()
 
double resetValue () const
 The reset value of this component. More...
 
bool hasAnimationKeyBrackets () const
 Determines if the animation key brackets around the component should be shown. More...
 
bool isIndeterminate () const
 Determines if the control should be shown in an indeterministic state. More...
 
bool isInteractive () const
 Determines whether this component is in interactive mode. More...
 
int visibleDigits () const
 The number of digits (before the period and the decimals) used for the calculation of the minimum width of the component. More...
 
void setDecimals (int decimals)
 Sets the number of decimals used. More...
 
QValidator::State validate (QString &input, int &pos) const override
 
void stepBy (int steps) override
 
QSize sizeHint () const override
 
QSize minimumSizeHint () const override
 

Protected Member Functions

void mousePressEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void timerEvent (QTimerEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void contextMenuEvent (QContextMenuEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void setInteractive (bool interactive, bool userCanceled=false)
 
QString textFromValue (double val) const override
 
double valueFromText (const QString &text) const override
 
 QmaxDoubleSpinBox (QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox > *d, QWidget *parent=nullptr)
 
QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox > * d_func ()
 
const QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox > * d_func () const
 

Protected Attributes

QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox > * d_ptr
 

Properties

double resetValue
 The reset value of this Component. More...
 
bool animationKeyBrackets
 Show the animation key brackets around the component. More...
 
bool indeterminate
 Draws '—' instead of the value to show the indeterministic state. More...
 
bool interactive
 Determines whether this component is in interactive mode. More...
 
int visibleDigits
 The number of digits used for the calculation of the minimum width of the component - values from -127 to +127 are valid, the default value is 6. More...
 

Friends

class QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox >
 

Detailed Description

3ds Max's version of a Qt QDoubleSpinBox.

This class derives from QDoubleSpinBox and adds some 3ds Max specific properties and behaviors to it. In general, it behaves almost exactly like the regular Qt QDoubleSpinBox, with these additions:

  • The stepping buttons can be pressed and dragged up or down to change the value of the component quickly. Holding down the ALT key while doing so will divide the speed of the value change by 10, while pressing and holding down the CTRL key will multiply the speed by 10.
  • Right-click on the stepping buttons will reset the control.
  • A context menu will appear for adding/removing animation keys, etc. when this control is bound to an animatable parameter block value.
  • There are some additional properties, as documented, such as the one that drives the painting of the animation key brackets.

This widget is intended to be used in plug-ins instead of QDoubleSpinBox to ensure consistency with the 3ds Max UI behavior.

See also
QDoubleSpinBox, QmaxSpinBox

Constructor & Destructor Documentation

◆ QmaxDoubleSpinBox() [1/2]

QmaxDoubleSpinBox ( QWidget *  parent = nullptr)
explicit

◆ ~QmaxDoubleSpinBox()

virtual ~QmaxDoubleSpinBox ( )
virtual

◆ QmaxDoubleSpinBox() [2/2]

QmaxDoubleSpinBox ( QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox > *  d,
QWidget *  parent = nullptr 
)
explicitprotected

Member Function Documentation

◆ resetValue()

double resetValue ( ) const

The reset value of this component.

If a user right-clicks the button-area of the control, it will be reset to this value.

Returns
The reset - aka default - value of this component.
See also
reset(), resetValue(), setResetValue( double )

◆ hasAnimationKeyBrackets()

bool hasAnimationKeyBrackets ( ) const

Determines if the animation key brackets around the component should be shown.

Note
This property normally gets driven internally by the parameter block binding, so if this component it bound to a parameter block, it may change automatically while scrubbing through the time-line, etc.
Returns
True, if the animation key brackets should be shown.
See also
setAnimationKeyBrackets()

◆ isIndeterminate()

bool isIndeterminate ( ) const

Determines if the control should be shown in an indeterministic state.

In this state, it displays '—' instead of the value.

Note
The control is not disabled, so clicking into it still allows the user to enter a new value.
See also
setIndeterminate()

◆ isInteractive()

bool isInteractive ( ) const

Determines whether this component is in interactive mode.

A Component is in interactive mode if a user is changing its value in a continuous manner, that may be cancelled by the user at the end of the interaction. For the spinner this is while dragging the buttons to change the value or by holding down the left mouse-button over a button to increment or decrement the value over time.

The basic idea of having an interactive mode is to enable the undo/redo system to track those interactive continuous changes as ONE single change (or even just ignores the change on cancel).

Therefore the interactiveChanged signal that gets emitted as soon as the interactive mode changes has an additional parameter that is only meant to be meaningful on ending an interactive session: the userCancelled parameter.

See also
interactiveChanged(), interactiveChanged

◆ visibleDigits()

int visibleDigits ( ) const

The number of digits (before the period and the decimals) used for the calculation of the minimum width of the component.

The actual displayed number of digits may vary.

The calculation of the minimum width is done in this way:

Qt internally calculates the widths of the renderings of the minimum and maximum values of the QSpinBox using its font, as well as - if set - the specialValueText property to determine the actual width needed to show all possible values. This value is used, if visibleDigits is set to 0.

Then the width of a value containing the absolute of visibleDigits digits, such as "222222.333" for 6 visibleDigits (and 3 decimals), is calculated using the widget's font, including prefix and suffix. If the visibleDigits is greater than 0, this value is compared against the prior calculation result and the minimum of both is used - meaning the QmaxSpin box will reserve up to visibleDigits space, but nor more.

If the visibleDigits is a negative number, the result of this calculation is used, regardless of the fact that it might be able to display all its values in a smaller space. This may be helpful to align different spin- boxes more precisely.

The default value for 3ds Max is 6 - but can be changed by the user with this entry in the 3dsmax.ini file :

[UI]
int visibleDigits
The number of digits used for the calculation of the minimum width of the component - values from -12...
Definition: QmaxSpinBox.h:413
Namespace UI (Userinterface) Containing the namespace, EMouseCursors containing the function to load ...
Definition: MouseCursors.h:24
See also
visibleDigits, setVisibleDigits(), visibleDigitsChanged()

◆ setDecimals()

void setDecimals ( int  decimals)

Sets the number of decimals used.

Calling this function with a non-negative param will flag the component to override the 3ds Max default decimal setting. Note that once this method is called, this component will no longer reflect any changes in the 3ds Max settings.

Parameters
decimalsThe number of decimals to be used, or -1 to switch the component back to use the 3ds Max default settings, and re-enable the component to reflect any changes to those settings.
Note
This function only overloads the (non-virtual) setDecimal() function of the underlying QDoubleSpinBox, so beware that this only works when calling it on a pointer/object with an actual type of QmaxDoubleSpinBox or QmaxWorldSpinBox.
See also
QDoubleSpinBox::setDecimals

◆ validate()

QValidator::State validate ( QString &  input,
int pos 
) const
override

◆ stepBy()

void stepBy ( int  steps)
override

◆ sizeHint()

QSize sizeHint ( ) const
override

◆ minimumSizeHint()

QSize minimumSizeHint ( ) const
override

◆ interactiveChanged

void interactiveChanged ( bool  interactive,
bool  userCancelled = false 
)
signal

Gets emitted as soon the component's interactive mode changes.

Parameters
interactiveThe new interactive mode of the component.
userCancelledTrue if the user actively cancelled an interactive session, for example by pressing the right mouse-button during a interactive dragging-operation. As a matter of fact, this parameter is only meaningful if the interactive parameter was false.
See also
interactiveChanged(), interactiveChanged

◆ contextMenuCustomization

void contextMenuCustomization ( QMenu &  contextMenu)
signal

Gets emitted when the context menu is shown.

Parameters
contextMenuA menu in which custom actions can be added.

◆ visibleDigitsChanged

void visibleDigitsChanged ( int  visibleDigits)
signal

Gets emitted when the visibleDigits have been changed.

Parameters
visibleDigitsThe new value of the visibleDigits property.
See also
QmaxDoubleSpinBox::visibleDigits, setVisibleDigits(), visibleDigits()

◆ setResetValue

void setResetValue ( double  resetValue)
slot

Changes the reset value of this component.

Parameters
[in]resetValueThe new resetValue
See also
reset(), resetValue()

◆ setAnimationKeyBrackets

void setAnimationKeyBrackets ( bool  animationKeyBrackets = true)
slot

Sets whether the animation key brackets around the component should be shown.

Note
This property normally gets driven internally by the parameter block binding, so if this component it bound to a parameter block, it may change automatically while scrubbing through the time-line, etc.
See also
hasAnimationKeyBrackets()

◆ setIndeterminate

void setIndeterminate ( bool  indeterminate)
slot

Sets whether the control should be shown in an indeterministic state.

In this state, it displays '—' instead of the value.

Note
The control is not disabled, so clicking into it still allows the user to enter a new value.
See also
setIndeterminate()

◆ setVisibleDigits

void setVisibleDigits ( int  visibleDigits)
slot

Sets the visibleDigits property.

Will emit a visibleDigitsChanged(visibleDigits) signal, if the property was changed.

See also
QmaxDoubleSpinBox::visibleDigits, visibleDigits(), visibleDigitsChanged

◆ reset

void reset ( )
slot

Resets this component's value to its resetValue.

See also
setResetValue(), resetValue()

◆ mousePressEvent()

void mousePressEvent ( QMouseEvent *  event)
overrideprotected

◆ mouseMoveEvent()

void mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

◆ mouseReleaseEvent()

void mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

◆ timerEvent()

void timerEvent ( QTimerEvent *  event)
overrideprotected

◆ paintEvent()

void paintEvent ( QPaintEvent *  event)
overrideprotected

◆ contextMenuEvent()

void contextMenuEvent ( QContextMenuEvent *  event)
overrideprotected

◆ keyPressEvent()

void keyPressEvent ( QKeyEvent *  event)
overrideprotected

◆ setInteractive()

void setInteractive ( bool  interactive,
bool  userCanceled = false 
)
protected

◆ textFromValue()

QString textFromValue ( double  val) const
overrideprotected

◆ valueFromText()

double valueFromText ( const QString &  text) const
overrideprotected

◆ d_func() [1/2]

QmaxSpinBoxPrivate<double, QmaxDoubleSpinBox>* d_func ( )
inlineprotected
277 { return d_ptr; }
QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox > * d_ptr
Definition: QmaxSpinBox.h:280

◆ d_func() [2/2]

const QmaxSpinBoxPrivate<double, QmaxDoubleSpinBox>* d_func ( ) const
inlineprotected
278 { return d_ptr; }

Friends And Related Function Documentation

◆ QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox >

friend class QmaxSpinBoxPrivate< double, QmaxDoubleSpinBox >
friend

Member Data Documentation

◆ d_ptr

QmaxSpinBoxPrivate<double,QmaxDoubleSpinBox>* d_ptr
protected

Property Documentation

◆ resetValue

double resetValue
readwrite

The reset value of this Component.

See also
resetValue(), setResetValue( double )

◆ animationKeyBrackets

bool animationKeyBrackets
readwrite

Show the animation key brackets around the component.

See also
hasAnimationKeyBrackets(), setAnimationKeyBrackets()

◆ indeterminate

bool indeterminate
readwrite

Draws '—' instead of the value to show the indeterministic state.

See also
isIndeterminate(), setIndeterminate()

◆ interactive

bool interactive
read

Determines whether this component is in interactive mode.

See also
isInteractive(), interactiveChanged()

◆ visibleDigits

int visibleDigits
readwrite

The number of digits used for the calculation of the minimum width of the component - values from -127 to +127 are valid, the default value is 6.

See also
visibleDigits(), setVisibleDigits(), visibleDigitsChanged()