3ds Max C++ API Reference
QmaxSpinBox Class Reference

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

#include <QmaxSpinBox.h>

+ Inheritance diagram for QmaxSpinBox:

Public Slots

void setResetValue (int 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

 QmaxSpinBox (QWidget *parent=nullptr)
 
virtual ~QmaxSpinBox ()
 
int 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
 
QValidator::State validate (QString &input, int &pos) const override
 
void stepBy (int steps) override
 
QSize minimumSizeHint () const override
 
QSize sizeHint () 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)
 
int valueFromText (const QString &text) const override
 
 QmaxSpinBox (QmaxSpinBoxPrivate< int, QmaxSpinBox > *d, QWidget *parent=nullptr)
 
QmaxSpinBoxPrivate< int, QmaxSpinBox > * d_func ()
 
const QmaxSpinBoxPrivate< int, QmaxSpinBox > * d_func () const
 

Protected Attributes

QmaxSpinBoxPrivate< int, QmaxSpinBox > * d_ptr
 

Properties

int 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< int, QmaxSpinBox >
 

Detailed Description

3ds Max's version of a Qt QSpinBox.

This class derives from QSpinBox and adds some 3ds Max specific properties and behaviors to it. In general, it behaves almost exactly like the regular Qt QSpinBox, 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 paramblock 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 QSpinBox to ensure consistency with the 3ds Max UI behavior.

See also
QSpinBox, QmaxDoubleSpinBox

Constructor & Destructor Documentation

◆ QmaxSpinBox() [1/2]

QmaxSpinBox ( QWidget *  parent = nullptr)
explicit

◆ ~QmaxSpinBox()

virtual ~QmaxSpinBox ( )
virtual

◆ QmaxSpinBox() [2/2]

QmaxSpinBox ( QmaxSpinBoxPrivate< int, QmaxSpinBox > *  d,
QWidget *  parent = nullptr 
)
explicitprotected

Member Function Documentation

◆ resetValue()

int resetValue ( ) const

The reset value of this Component.

See also
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

◆ validate()

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

◆ stepBy()

void stepBy ( int  steps)
override

◆ minimumSizeHint()

QSize minimumSizeHint ( ) const
override

◆ sizeHint()

QSize sizeHint ( ) 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 ( int  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

◆ valueFromText()

int valueFromText ( const QString &  text) const
overrideprotected

◆ d_func() [1/2]

QmaxSpinBoxPrivate<int, QmaxSpinBox>* d_func ( )
inlineprotected
521 { return d_ptr; }
QmaxSpinBoxPrivate< int, QmaxSpinBox > * d_ptr
Definition: QmaxSpinBox.h:524

◆ d_func() [2/2]

const QmaxSpinBoxPrivate<int, QmaxSpinBox>* d_func ( ) const
inlineprotected
522 { return d_ptr; }

Friends And Related Function Documentation

◆ QmaxSpinBoxPrivate< int, QmaxSpinBox >

friend class QmaxSpinBoxPrivate< int, QmaxSpinBox >
friend

Member Data Documentation

◆ d_ptr

QmaxSpinBoxPrivate<int, QmaxSpinBox>* d_ptr
protected

Property Documentation

◆ resetValue

int 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

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.

The number of digits that is used for the calculation of the minimum width of the component.

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

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" for 6 visibleDigits, 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()