drumstick 2.9.0
C++ MIDI libraries using Qt objects, idioms, and style.
PianoKeybd Class Reference

The PianoKeybd class. More...

#include <pianokeybd.h>

Inheritance diagram for PianoKeybd:

Signals

void noteOn (int midiNote, int vel)
 This signal is emitted for each Note On MIDI event created using the computer keyboard, mouse or touch screen. More...
 
void noteOff (int midiNote, int vel)
 This signal is emitted for each Note Off MIDI event created using the computer keyboard, mouse or touch screen. More...
 
void signalName (const QString &name)
 signalName is emitted for each note created, and contains a string with the MIDI note number and the note name for each note on event. More...
 

Public Member Functions

 PianoKeybd (QWidget *parent=nullptr)
 Constructor. More...
 
 PianoKeybd (const int baseOctave, const int numKeys, const int startKey, QWidget *parent=nullptr)
 Constructor providing not only a parent widget, but also custom values for octave, number of keys and starting key. More...
 
virtual ~PianoKeybd ()
 Destructor.
 
void setFont (const QFont &font)
 Assigns a typographic font for drawing the note labels over the piano keys. More...
 
PianoHandlergetPianoHandler () const
 Gets the PianoHandler pointer to the note receiver. More...
 
void setPianoHandler (PianoHandler *handler)
 Assigns a PianoHandler pointer for processing note events. More...
 
PianoPalette getHighlightPalette () const
 Returns the palette used for highlighting the played keys. More...
 
void setHighlightPalette (const PianoPalette &p)
 Assigns the palette used for highlighting the played keys. More...
 
PianoPalette getBackgroundPalette () const
 Returns the palette used to paint the keys' background. More...
 
void setBackgroundPalette (const PianoPalette &p)
 Assigns the palette used to paint the keys' background. More...
 
PianoPalette getForegroundPalette () const
 Returns the palette used to paint texts over the keys like the note names or custom labels. More...
 
void setForegroundPalette (const PianoPalette &p)
 Assigns the palette used to paint texts over the keys like the note names or custom labels. More...
 
bool showColorScale () const
 Returns true if the color scale background palette is assigned and active. More...
 
void setShowColorScale (const bool show)
 Enables or disables the color scale background palette. More...
 
void useCustomNoteNames (const QStringList &names)
 Assigns a list of custom text labels to be displayer over the keys. More...
 
void useStandardNoteNames ()
 Disables the custom note names usage as labels over the keys, and restores the standard note names instead.
 
QStringList customNoteNames () const
 Returns the list of custom note names. More...
 
QStringList standardNoteNames () const
 Returns the list of standard note names. More...
 
void retranslate ()
 Updates the standard names of notes according to the currently active program language translation. More...
 
int baseOctave () const
 Returns the base octave number. More...
 
void setBaseOctave (const int baseOctave)
 Assigns the base octave number. More...
 
int numKeys () const
 Returns the total number of keys. More...
 
int startKey () const
 Returns the starting key note: C=0, A=9 and so on. More...
 
void setNumKeys (const int numKeys, const int startKey=DEFAULTSTARTINGKEY)
 This method changes the number of displayed keys and the starting key number, keeping the other settings the same. More...
 
int getRotation () const
 Returns the rotation angle in degrees, clockwise, of the piano view. More...
 
void setRotation (int r)
 Rotates the keyboard view an angle clockwise. More...
 
QColor getKeyPressedColor () const
 Returns the key highlight color. More...
 
void setKeyPressedColor (const QColor &c)
 Assigns a single color for key highlight. More...
 
void resetKeyPressedColor ()
 Assigns the default highlight palette colors and assigns it to the scene.
 
LabelVisibility showLabels () const
 Returns the label visibility policy. More...
 
void setShowLabels (const LabelVisibility show)
 Assigns the label visibility policy. More...
 
LabelAlteration labelAlterations () const
 Returns the label alterations policy. More...
 
void setLabelAlterations (const LabelAlteration use)
 Assigns the label alterations policy. More...
 
LabelOrientation labelOrientation () const
 Returns the labels orientation policy. More...
 
void setLabelOrientation (const LabelOrientation orientation)
 Assigns the labels orientation policy. More...
 
LabelCentralOctave labelOctave () const
 Returns the octave label policy. More...
 
void setLabelOctave (const LabelCentralOctave octave)
 Assigns the octave label policy. More...
 
int getTranspose () const
 Returns the transpose amount in semitones. More...
 
void setTranspose (int t)
 Assigns the transpose amount in semitones. More...
 
int getChannel () const
 Returns the MIDI Channel (0-15). More...
 
void setChannel (const int c)
 Assigns the MIDI Channel (0-15). More...
 
int getVelocity () const
 Returns the MIDI note velocity. More...
 
void setVelocity (const int v)
 Assigns the MIDI note velocity. More...
 
bool isKeyboardEnabled () const
 Returns whether the computer keyboard is enabled. More...
 
void setKeyboardEnabled (const bool enable)
 Enables or disables the computer keyboard note input. More...
 
bool isMouseEnabled () const
 Returns whether the mouse note input is enabled. More...
 
void setMouseEnabled (const bool enable)
 Enables or disables the mouse note input. More...
 
bool isTouchEnabled () const
 Returns whether the touch screen note input is enabled. More...
 
void setTouchEnabled (const bool enable)
 Enables or disables the touch screen note input. More...
 
bool velocityTint () const
 Returns whether the note MIDI velocity influences the highlight color tint. More...
 
void setVelocityTint (const bool enable)
 Enables or disables the note MIDI velocity influencing the highlight color tint. More...
 
void allKeysOff ()
 Forces all active notes to silence.
 
QSize sizeHint () const override
 Overrides QGraphicsView::sizeHint() providing a size value based on the piano scene. More...
 
void setKeyboardMap (KeyboardMap *m)
 Assigns the computer keyboard note map. More...
 
KeyboardMapgetKeyboardMap ()
 Returns the computer keyboard note map. More...
 
void resetKeyboardMap ()
 Resets the low level computer keyboard note map to the default one.
 
void setRawKeyboardMap (KeyboardMap *m)
 Assigns the low level computer keyboard note map. More...
 
KeyboardMapgetRawKeyboardMap ()
 Returns the low level computer keyboard note map. More...
 
void resetRawKeyboardMap ()
 Resets the computer keyboard note map to the default one.
 
bool getRawKeyboardMode () const
 Returns the low level computer keyboard note map. More...
 
void setRawKeyboardMode (const bool b)
 Enables or disables the low level computer keyboard mode. More...
 
void showNoteOn (const int note, QColor color, int vel=-1)
 Highlights one note key with the specified color and velocity. More...
 
void showNoteOn (const int note, int vel=-1)
 Highlights one note key with the specified velocity. More...
 
void showNoteOff (const int note, int vel=-1)
 Shows inactive one note key with the specified velocity. More...
 
bool handleKeyPressed (int keycode) override
 handleKeyPressed handles low level computer keyboard press events More...
 
bool handleKeyReleased (int keycode) override
 handleKeyReleased handles low level computer keyboard reelase events More...
 
void setKeyPicture (const bool natural, const QPixmap &pix)
 Assigns a custom picture to the white or black keys that will be used as a texture to paint the keys. More...
 
QPixmap getKeyPicture (const bool natural)
 Returns the custom picture used to paint the corresponding keys. More...
 
void setUseKeyPictures (const bool enable)
 Enables or disables a picture to paint the keys. More...
 
bool getUseKeyPictures () const
 Returns whether pictures are used to paint the keys. More...
 
void setUsingNativeFilter (const bool newState)
 Enables or disables the application level usage of a native event filter. More...
 
bool isUsingNativeFilter () const
 Returns whether the application is filtering native events. More...
 
void setOctaveSubscript (const bool enable)
 Enables or disables the octave subscript designation. More...
 
bool octaveSubscript () const
 Returns whether the octave subscript designation is enabled. More...
 
void setStartKey (const int startKey)
 Sets the initial/starting note key. More...
 

Protected Member Functions

void initialize ()
 This method is called from the available constructors to initialize some widget attributes, settings, and optimizations.
 
void initScene (int base, int num, int ini, const QColor &c=QColor())
 Creates and initializes a new PianoScene instance and assigns it to this widget. More...
 
void resizeEvent (QResizeEvent *event) override
 This method overrides QGraphicsView::resizeEvent() to keep the aspect ratio of the keys scene when the view is resized. More...
 
bool viewportEvent (QEvent *ev) override
 This method overrides QGraphicsView::viewportEvent() Only touchscreen events are processed here. More...
 

Detailed Description

The PianoKeybd class.

This class is a widget providing the look and behavior of a musical piano keyboard. It is implemented as a QGraphicsView displaying the contents of a QGraphicsScene (PianoScene).

Definition at line 175 of file pianokeybd.h.

Constructor & Destructor Documentation

◆ PianoKeybd() [1/2]

PianoKeybd ( QWidget *  parent = nullptr)
explicit

Constructor.

This is the usual constructor when using QtDesigner and without providing custom settings, using the default octave, number of keys and starting key.

Parameters
parentWidget's parent

Definition at line 225 of file pianokeybd.cpp.

References drumstick::widgets::DEFAULTBASEOCTAVE, drumstick::widgets::DEFAULTNUMBEROFKEYS, drumstick::widgets::DEFAULTSTARTINGKEY, PianoKeybd::initialize(), and PianoKeybd::initScene().

◆ PianoKeybd() [2/2]

PianoKeybd ( const int  baseOctave,
const int  numKeys,
const int  startKey,
QWidget *  parent = nullptr 
)

Constructor providing not only a parent widget, but also custom values for octave, number of keys and starting key.

Parameters
baseOctaveThe base octave number
numKeysThe number of displayed keys
startKeyThe startup key
parentThe widget's parent

Definition at line 240 of file pianokeybd.cpp.

References PianoKeybd::initialize(), and PianoKeybd::initScene().

Member Function Documentation

◆ baseOctave()

int baseOctave ( ) const

Returns the base octave number.

See also
setBaseOctave()
Returns
the base octave number

Definition at line 682 of file pianokeybd.cpp.

◆ customNoteNames()

QStringList customNoteNames ( ) const

Returns the list of custom note names.

Returns
the list of custom key names

Definition at line 384 of file pianokeybd.cpp.

◆ getBackgroundPalette()

PianoPalette getBackgroundPalette ( ) const

Returns the palette used to paint the keys' background.

Returns
The PianoPalette used to paint the keys' background

Definition at line 305 of file pianokeybd.cpp.

◆ getChannel()

int getChannel ( ) const

Returns the MIDI Channel (0-15).

Returns
the MIDI Channel (0-15)

Definition at line 856 of file pianokeybd.cpp.

◆ getForegroundPalette()

PianoPalette getForegroundPalette ( ) const

Returns the palette used to paint texts over the keys like the note names or custom labels.

Returns
The PianoPalette used to paint the keys' foreground

Definition at line 324 of file pianokeybd.cpp.

◆ getHighlightPalette()

PianoPalette getHighlightPalette ( ) const

Returns the palette used for highlighting the played keys.

Returns
The PianoPalette used to highlight the played keys

Definition at line 285 of file pianokeybd.cpp.

◆ getKeyboardMap()

KeyboardMap * getKeyboardMap ( )

Returns the computer keyboard note map.

Returns
the computer keyboard note map

Definition at line 984 of file pianokeybd.cpp.

◆ getKeyPicture()

QPixmap getKeyPicture ( const bool  natural)

Returns the custom picture used to paint the corresponding keys.

Parameters
naturaltrue for white keys, false for black keys
Returns
a transparent QPixmap used to paint the keys

Definition at line 580 of file pianokeybd.cpp.

◆ getKeyPressedColor()

QColor getKeyPressedColor ( ) const

Returns the key highlight color.

Returns
the key highlight color

Definition at line 728 of file pianokeybd.cpp.

◆ getPianoHandler()

PianoHandler * getPianoHandler ( ) const

Gets the PianoHandler pointer to the note receiver.

If this method returns null, then there is not a PianoHandler class assigned, and then the signals noteOn() and noteOff() are emitted instead.

Returns
pointer to the PianoHandler class, if there is one assigned

Definition at line 263 of file pianokeybd.cpp.

◆ getRawKeyboardMap()

KeyboardMap * getRawKeyboardMap ( )

Returns the low level computer keyboard note map.

Returns
the low level computer keyboard note map

Definition at line 1038 of file pianokeybd.cpp.

◆ getRawKeyboardMode()

bool getRawKeyboardMode ( ) const

Returns the low level computer keyboard note map.

Returns
the low level computer keyboard note map

Definition at line 1002 of file pianokeybd.cpp.

◆ getRotation()

int getRotation ( ) const

Returns the rotation angle in degrees, clockwise, of the piano view.

Returns
the rotation angle in degrees.

Definition at line 719 of file pianokeybd.cpp.

◆ getTranspose()

int getTranspose ( ) const

Returns the transpose amount in semitones.

See also
setTranspose()
Returns
the transpose amount in semitones

Definition at line 837 of file pianokeybd.cpp.

◆ getUseKeyPictures()

bool getUseKeyPictures ( ) const

Returns whether pictures are used to paint the keys.

Returns
true if the pictures are enabled to paint the keys

Definition at line 598 of file pianokeybd.cpp.

◆ getVelocity()

int getVelocity ( ) const

Returns the MIDI note velocity.

See also
setVelocity()
Returns
the MIDI note velocity

Definition at line 875 of file pianokeybd.cpp.

◆ handleKeyPressed()

bool handleKeyPressed ( int  keycode)
overridevirtual

handleKeyPressed handles low level computer keyboard press events

Parameters
keycodeThe low level key code pressed
Returns
whether the event has been processed or not

Implements RawKbdHandler.

Definition at line 546 of file pianokeybd.cpp.

◆ handleKeyReleased()

bool handleKeyReleased ( int  keycode)
overridevirtual

handleKeyReleased handles low level computer keyboard reelase events

Parameters
keycodeThe low level key code released
Returns
whether the event has been processed or not

Implements RawKbdHandler.

Definition at line 555 of file pianokeybd.cpp.

◆ initScene()

void initScene ( int  base,
int  num,
int  strt,
const QColor &  c = QColor() 
)
protected

Creates and initializes a new PianoScene instance and assigns it to this widget.

Parameters
baseoctave base number
numnumber of displayed keys
strtstarting note number
csingle default highlight color

Definition at line 415 of file pianokeybd.cpp.

References drumstick::widgets::g_DefaultKeyMap, PianoKeybd::noteOff(), PianoScene::noteOff(), PianoKeybd::noteOn(), PianoScene::noteOn(), PianoKeybd::signalName(), and PianoScene::signalName().

Referenced by PianoKeybd::PianoKeybd(), and PianoKeybd::setNumKeys().

◆ isKeyboardEnabled()

bool isKeyboardEnabled ( ) const

Returns whether the computer keyboard is enabled.

Returns
true if the computer keyboard is enabled.

Definition at line 894 of file pianokeybd.cpp.

◆ isMouseEnabled()

bool isMouseEnabled ( ) const

Returns whether the mouse note input is enabled.

Returns
true if the mouse note input is enabled

Definition at line 912 of file pianokeybd.cpp.

◆ isTouchEnabled()

bool isTouchEnabled ( ) const

Returns whether the touch screen note input is enabled.

Returns
true if the touch screen note input is enabled

Definition at line 930 of file pianokeybd.cpp.

Referenced by PianoKeybd::viewportEvent().

◆ isUsingNativeFilter()

bool isUsingNativeFilter ( ) const

Returns whether the application is filtering native events.

The native event filter should process low level keyboard events, calling the methods of the RawKbdHandler interface.

Returns
true if the application is filtering native events

Definition at line 625 of file pianokeybd.cpp.

◆ labelAlterations()

LabelAlteration labelAlterations ( ) const

Returns the label alterations policy.

See also
setLabelAlterations()
Returns
the label alterations policy

Definition at line 777 of file pianokeybd.cpp.

◆ labelOctave()

LabelCentralOctave labelOctave ( ) const

Returns the octave label policy.

See also
setLabelOctave()
Returns
the octave label policy

Definition at line 817 of file pianokeybd.cpp.

◆ labelOrientation()

LabelOrientation labelOrientation ( ) const

Returns the labels orientation policy.

See also
setLabelOrientation()
Returns
the labels orientation policy

Definition at line 797 of file pianokeybd.cpp.

◆ noteOff

void noteOff ( int  midiNote,
int  vel 
)
signal

This signal is emitted for each Note Off MIDI event created using the computer keyboard, mouse or touch screen.

It is not emitted if a PianoHandler has been assigned using setPianoHandler().

Parameters
midiNotethe MIDI note number
velthe MIDI velocity

Referenced by PianoKeybd::initScene().

◆ noteOn

void noteOn ( int  midiNote,
int  vel 
)
signal

This signal is emitted for each Note On MIDI event created using the computer keyboard, mouse or touch screen.

It is not emitted if a PianoHandler has been assigned using setPianoHandler().

Parameters
midiNotethe MIDI note number
velthe MIDI velocity

Referenced by PianoKeybd::initScene().

◆ numKeys()

int numKeys ( ) const

Returns the total number of keys.

See also
setNumKeys()
Returns
the number of keys displayed

Definition at line 701 of file pianokeybd.cpp.

◆ octaveSubscript()

bool octaveSubscript ( ) const

Returns whether the octave subscript designation is enabled.

According to the Scientific pitch notation (SPN), also known as American standard pitch notation (ASPN), the octave designation should be written as a subscript.

See also
setOctaveSubscript()
Returns
true if the octave subscript designation is enabled
Since
2.7.0

Definition at line 656 of file pianokeybd.cpp.

◆ resizeEvent()

void resizeEvent ( QResizeEvent *  event)
overrideprotected

This method overrides QGraphicsView::resizeEvent() to keep the aspect ratio of the keys scene when the view is resized.

Parameters
event

Definition at line 450 of file pianokeybd.cpp.

◆ retranslate()

void retranslate ( )

Updates the standard names of notes according to the currently active program language translation.

The custom note names are not affected.

Definition at line 403 of file pianokeybd.cpp.

◆ setBackgroundPalette()

void setBackgroundPalette ( const PianoPalette p)

Assigns the palette used to paint the keys' background.

Parameters
pPianoPalette const reference

Definition at line 314 of file pianokeybd.cpp.

◆ setBaseOctave()

void setBaseOctave ( const int  baseOctave)

Assigns the base octave number.

Parameters
baseOctavethe base octave number

Definition at line 691 of file pianokeybd.cpp.

◆ setChannel()

void setChannel ( const int  c)

Assigns the MIDI Channel (0-15).

Parameters
cthe MIDI Channel (0-15)

Definition at line 865 of file pianokeybd.cpp.

◆ setFont()

void setFont ( const QFont &  font)

Assigns a typographic font for drawing the note labels over the piano keys.

Parameters
fonttypographic font for drawing the note labels

Definition at line 1078 of file pianokeybd.cpp.

◆ setForegroundPalette()

void setForegroundPalette ( const PianoPalette p)

Assigns the palette used to paint texts over the keys like the note names or custom labels.

Parameters
pPianoPalette const reference

Definition at line 334 of file pianokeybd.cpp.

◆ setHighlightPalette()

void setHighlightPalette ( const PianoPalette p)

Assigns the palette used for highlighting the played keys.

When the palette has a single color, the method setKeyPressedColor() may be used instead.

See also
setKeyPressedColor()
Parameters
pPianoPalette const reference

Definition at line 296 of file pianokeybd.cpp.

◆ setKeyboardEnabled()

void setKeyboardEnabled ( const bool  enable)

Enables or disables the computer keyboard note input.

Parameters
enablethe computer keyboard note input.

Definition at line 903 of file pianokeybd.cpp.

◆ setKeyboardMap()

void setKeyboardMap ( KeyboardMap m)

Assigns the computer keyboard note map.

Parameters
mthe computer keyboard note map.

Definition at line 975 of file pianokeybd.cpp.

Referenced by PianoKeybd::~PianoKeybd().

◆ setKeyPicture()

void setKeyPicture ( const bool  natural,
const QPixmap &  pix 
)

Assigns a custom picture to the white or black keys that will be used as a texture to paint the keys.

Parameters
naturaltrue for white keys, false for black keys
pixthis transparent QPixmap will be used to paint the keys

Definition at line 570 of file pianokeybd.cpp.

◆ setKeyPressedColor()

void setKeyPressedColor ( const QColor &  c)

Assigns a single color for key highlight.

This is an alternative to creating a highlight palette with a single color and assigning it.

See also
setHighlightPalette()
Parameters
ccolor for key highlight

Definition at line 739 of file pianokeybd.cpp.

◆ setLabelAlterations()

void setLabelAlterations ( const LabelAlteration  use)

Assigns the label alterations policy.

See also
LabelAlteration
Parameters
usethe label alterations policy

Definition at line 787 of file pianokeybd.cpp.

◆ setLabelOctave()

void setLabelOctave ( const LabelCentralOctave  octave)

Assigns the octave label policy.

See also
LabelCentralOctave
Parameters
octavethe octave label policy

Definition at line 827 of file pianokeybd.cpp.

◆ setLabelOrientation()

void setLabelOrientation ( const LabelOrientation  orientation)

Assigns the labels orientation policy.

See also
LabelOrientation
Parameters
orientationthe labels orientation policy

Definition at line 807 of file pianokeybd.cpp.

◆ setMouseEnabled()

void setMouseEnabled ( const bool  enable)

Enables or disables the mouse note input.

Parameters
enablethe mouse note input

Definition at line 921 of file pianokeybd.cpp.

◆ setNumKeys()

void setNumKeys ( const int  numKeys,
const int  startKey = DEFAULTSTARTINGKEY 
)

This method changes the number of displayed keys and the starting key number, keeping the other settings the same.

The common industrial piano layout has 88 keys, and starts with A, so the default starting key value is 9. But any natural note/key number is possible as starting note key. The key/note values are: C=0, D=2, E=4, F=5, G=7, A=9, B=11.

See also
numKeys(), startKey(), setStartKey()
Parameters
numKeysThe new number of keys
startKeyThe number of the starting key

Definition at line 499 of file pianokeybd.cpp.

References PianoKeybd::initScene().

Referenced by PianoKeybd::setStartKey().

◆ setOctaveSubscript()

void setOctaveSubscript ( const bool  enable)

Enables or disables the octave subscript designation.

According to the Scientific pitch notation (SPN), also known as American standard pitch notation (ASPN), the octave designation should be written as a subscript, but it is an user choice.

See also
octaveSubscript()
Parameters
enableor disable using subscript octave numbers
Since
2.7.0

Definition at line 641 of file pianokeybd.cpp.

◆ setPianoHandler()

void setPianoHandler ( PianoHandler handler)

Assigns a PianoHandler pointer for processing note events.

When this member is used to assign a PianoHandler instance, then the methods in that instance are called instead of emitting the signals noteOn() and noteOff().

Parameters
handlerpointer to the PianoHandler instance

Definition at line 276 of file pianokeybd.cpp.

◆ setRawKeyboardMap()

void setRawKeyboardMap ( KeyboardMap m)

Assigns the low level computer keyboard note map.

Parameters
mthe low level computer keyboard note map

Definition at line 1028 of file pianokeybd.cpp.

◆ setRawKeyboardMode()

void setRawKeyboardMode ( const bool  b)

Enables or disables the low level computer keyboard mode.

Parameters
bthe low level computer keyboard mode

Definition at line 1011 of file pianokeybd.cpp.

◆ setRotation()

void setRotation ( int  r)

Rotates the keyboard view an angle clockwise.

Parameters
rrotating angle in degrees to rotate.

Definition at line 526 of file pianokeybd.cpp.

◆ setShowColorScale()

void setShowColorScale ( const bool  show)

Enables or disables the color scale background palette.

Parameters
showthe color scale activation state

Definition at line 352 of file pianokeybd.cpp.

◆ setShowLabels()

void setShowLabels ( const LabelVisibility  show)

Assigns the label visibility policy.

See also
LabelVisibility
Parameters
showthe label visibility policy

Definition at line 767 of file pianokeybd.cpp.

◆ setStartKey()

void setStartKey ( const int  startKey)

Sets the initial/starting note key.

The common industrial piano keys layout (88 keys) starts with A, so the default starting key value is 9. But any natural note/key number is possible as starting note key. The key/note values are: C=0, D=2, E=4, F=5, G=7, A=9, B=11.

See also
setNumKeys()
Since
2.7.0
Parameters
startKeyis a note/key number between 0 and 11

Definition at line 672 of file pianokeybd.cpp.

References PianoKeybd::setNumKeys().

◆ setTouchEnabled()

void setTouchEnabled ( const bool  enable)

Enables or disables the touch screen note input.

Parameters
enablethe touch screen note input.

Definition at line 939 of file pianokeybd.cpp.

◆ setTranspose()

void setTranspose ( int  t)

Assigns the transpose amount in semitones.

See also
getTranspose()
Parameters
tthe transpose amount in semitones

Definition at line 847 of file pianokeybd.cpp.

◆ setUseKeyPictures()

void setUseKeyPictures ( const bool  enable)

Enables or disables a picture to paint the keys.

Parameters
enableor disable

Definition at line 589 of file pianokeybd.cpp.

◆ setUsingNativeFilter()

void setUsingNativeFilter ( const bool  newState)

Enables or disables the application level usage of a native event filter.

The native event filter should process low level keyboard events, calling the methods of the RawKbdHandler interface. This method should be used in this case to indicate that the keyboard events should be ignored by the piano scene keyboard event handlers. Note: this is only necessary if the native filter does not block events.

Parameters
newStateof the application level usage of a native event filter

Definition at line 613 of file pianokeybd.cpp.

◆ setVelocity()

void setVelocity ( const int  v)

Assigns the MIDI note velocity.

See also
getVelocity()
Parameters
vthe MIDI note velocity

Definition at line 885 of file pianokeybd.cpp.

◆ setVelocityTint()

void setVelocityTint ( const bool  enable)

Enables or disables the note MIDI velocity influencing the highlight color tint.

Parameters
enablethe note MIDI velocity influencing the highlight color tint

Definition at line 957 of file pianokeybd.cpp.

◆ showColorScale()

bool showColorScale ( ) const

Returns true if the color scale background palette is assigned and active.

Returns
whether the color scale display is enabled or not

Definition at line 343 of file pianokeybd.cpp.

◆ showLabels()

LabelVisibility showLabels ( ) const

Returns the label visibility policy.

See also
setShowLabels()
Returns
the label visibility policy

Definition at line 757 of file pianokeybd.cpp.

◆ showNoteOff()

void showNoteOff ( const int  note,
int  vel = -1 
)

Shows inactive one note key with the specified velocity.

Parameters
noteThe MIDI note number
velThe MIDI note velocity

Definition at line 1069 of file pianokeybd.cpp.

◆ showNoteOn() [1/2]

void showNoteOn ( const int  note,
int  vel = -1 
)

Highlights one note key with the specified velocity.

Parameters
noteThe MIDI note number
velThe MIDI note velocity

Definition at line 1059 of file pianokeybd.cpp.

◆ showNoteOn() [2/2]

void showNoteOn ( const int  note,
QColor  color,
int  vel = -1 
)

Highlights one note key with the specified color and velocity.

Parameters
noteThe MIDI note number
colorThe highlight color
velThe MIDI note velocity

Definition at line 1049 of file pianokeybd.cpp.

◆ signalName

void signalName ( const QString &  name)
signal

signalName is emitted for each note created, and contains a string with the MIDI note number and the note name for each note on event.

Parameters
namethe MIDI note number and name

Referenced by PianoKeybd::initScene().

◆ sizeHint()

QSize sizeHint ( ) const
override

Overrides QGraphicsView::sizeHint() providing a size value based on the piano scene.

Returns
The sizeHint property of the piano view

Definition at line 540 of file pianokeybd.cpp.

◆ standardNoteNames()

QStringList standardNoteNames ( ) const

Returns the list of standard note names.

Returns
the list of standard key names

Definition at line 393 of file pianokeybd.cpp.

◆ startKey()

int startKey ( ) const

Returns the starting key note: C=0, A=9 and so on.

Returns
the starting key note.

Definition at line 710 of file pianokeybd.cpp.

◆ useCustomNoteNames()

void useCustomNoteNames ( const QStringList &  names)

Assigns a list of custom text labels to be displayer over the keys.

This can be used for instance, to display the names of the percussion sounds for General MIDI channel 10. The number of elements should be 128, when naming the whole set of MIDI notes, or at least 12 when naming the note names, in which case an octave designation may be attached to the supplied name.

Parameters
nameslist of key labels

Definition at line 366 of file pianokeybd.cpp.

◆ velocityTint()

bool velocityTint ( ) const

Returns whether the note MIDI velocity influences the highlight color tint.

Returns
true if the note MIDI velocity influences the highlight color tint

Definition at line 948 of file pianokeybd.cpp.

◆ viewportEvent()

bool viewportEvent ( QEvent ev)
overrideprotected

This method overrides QGraphicsView::viewportEvent() Only touchscreen events are processed here.

Parameters
evThe viewport event
Returns
true if the event has been consumed, false otherwise

Definition at line 462 of file pianokeybd.cpp.

References PianoKeybd::isTouchEnabled().


The documentation for this class was generated from the following files: