Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AutoScaledToKeyboardGraphicsView Class Reference

An GraphicsViewAdaptorForQt keeping the same size as a KeyboardGraphicsView. More...

#include <autoscaledtokeyboardgraphicsview.h>

+ Inheritance diagram for AutoScaledToKeyboardGraphicsView:
+ Collaboration diagram for AutoScaledToKeyboardGraphicsView:

Public Types

enum  ItemRoles { ROLE_HIGHLIGHT = 1024 }
 
- Public Types inherited from GraphicsViewAdapter
enum  PenType {
  PEN_THIN_BLACK, PEN_MEDIUM_BLACK, PEN_THIN_VERY_LIGHT_GRAY, PEN_THIN_LIGHT_GRAY,
  PEN_THIN_DARK_GRAY, PEN_MEDIUM_LIGHT_GRAY, PEN_MEDIUM_DARK_GRAY, PEN_MEDIUM_GRAY,
  PEN_THIN_CYAN, PEN_MEDIUM_CYAN, PEN_MEDIUM_ORANGE, PEN_MEDIUM_MAGENTA,
  PEN_THIN_MAGENTA, PEN_THIN_RED, PEN_MEDIUM_RED, PEN_THIN_BLUE,
  PEN_THIN_TRANSPARENT, PEN_MEDIUM_DARK_GREEN
}
 Available pen types for drawing. More...
 
enum  FillTypes {
  FILL_TRANSPARENT, FILL_LIGHT_GRAY, FILL_RED, FILL_ORANGE,
  FILL_GREEN, FILL_LIGHT_GREEN, FILL_BLUE
}
 Available filling colors (e.g. to fill rectangles) More...
 
using RoleType = GraphicsItem::RoleType
 
using ComplexVector = std::vector< std::complex< double >>
 Abstract function: Draw stroboscope. More...
 

Public Member Functions

 AutoScaledToKeyboardGraphicsView (QWidget *parent, DrawerBase *drawer)
 Constructor. More...
 
 ~AutoScaledToKeyboardGraphicsView ()
 Destructor. More...
 
void setKeyboard (KeyboardGraphicsView *keyboardgraphicsview)
 Setter function for the keyboard. More...
 
void highlightKey (int key)
 Function that will highlight the given key. More...
 
- Public Member Functions inherited from GraphicsViewAdapterForQt
 GraphicsViewAdapterForQt (QWidget *parent, DrawerBase *drawer, QRectF sceneRect)
 Constructor. More...
 
 ~GraphicsViewAdapterForQt ()
 Destructor, removing all graphics items from the list. More...
 
void setSceneRect (const QRectF &rect)
 Setter function for the scene rectangle. More...
 
QPointF convertRelToAbs (const QPointF &p) const
 Converting from relative to absolute coordinates. More...
 
QSizeF convertRelToAbs (const QSizeF &s) const
 Converting from relative to absolute coordinates. More...
 
QLineF convertRelToAbsLine (qreal x1, qreal y1, qreal x2, qreal y2) const
 Converting of a line from relative to absolute coordinates. More...
 
QPointF convertAbsToRel (const QPointF &p) const
 Converting from absolute to relative coordinates. More...
 
- Public Member Functions inherited from GraphicsViewAdapter
 GraphicsViewAdapter ()
 Empty constructor. More...
 
 ~GraphicsViewAdapter ()
 Destructor clearing the view. More...
 
GraphicItemsListgetGraphicItems ()
 Get the list of the graphic items. More...
 
const GraphicItemsListgetGraphicItems () const
 Get a constant list of the graphic items. More...
 
GraphicsItemgetGraphicItem (int keyIndex, RoleType role)
 Get a single graphics element specified by its index and its role. More...
 
GraphicsItemgetGraphicItemByRole (RoleType role)
 Get the first of all graphics elements with a given role. More...
 
GraphicItemsList getGraphicItems (int keyIndex)
 Get a list of graphic items that match with the keyIndex. More...
 
GraphicItemsList getGraphicItemsByRole (RoleType role)
 Get a list of graphic items that match with the given role. More...
 
GraphicItemsList getGraphicItems (int keyIndex, RoleType role)
 Get the list of all graphics elements of a given key and role. More...
 

Protected Member Functions

void showEvent (QShowEvent *event) override
 Reimplemented to keep the visible view with the KeyboardGraphicsView. More...
 
void resizeEvent (QResizeEvent *event) override
 Reimplemented to keep the visible view with the KeyboardGraphicsView. More...
 
- Protected Member Functions inherited from GraphicsViewAdapterForQt
void showEvent (QShowEvent *event) override
 Show the scene (reimplemented show event). More...
 
void resizeEvent (QResizeEvent *event) override
 Resize the scene (reimplemented resize event). More...
 
virtual void clear () override
 Clear the scene. More...
 
virtual GraphicsItemdrawLine (double x1, double y1, double x2, double y2, PenType pen) override
 Abstract function: Draw a line. More...
 
virtual GraphicsItemdrawChart (const std::vector< Point > &points, PenType pen) override
 Abstract function: Draw a chart (polygon). More...
 
virtual GraphicsItemdrawFilledRect (double x, double y, double w, double h, PenType pen, FillTypes fill) override
 Abstract function: Draw a filled rectangle. More...
 
virtual void drawStroboscope (const ComplexVector &data) override
 

Protected Attributes

KeyboardGraphicsViewmKeyboardGraphicsView
 Pointer to the KeyboardGraphicsView. More...
 
- Protected Attributes inherited from GraphicsViewAdapterForQt
DrawerBasemDrawer
 The drawer of this GraphicsViewAdapterForQt. More...
 
QGraphicsScene mScene
 The QGraphicsScene. More...
 
QRectF mSceneRect
 The scene rect. More...
 

Detailed Description

An GraphicsViewAdaptorForQt keeping the same size as a KeyboardGraphicsView.

The tuning cureve and signal spectrum have to stay at the same size as the keyboard. This class will automatically adjust the visible view if it resizes or is shown.

Definition at line 37 of file autoscaledtokeyboardgraphicsview.h.

Member Enumeration Documentation

Enumerator
ROLE_HIGHLIGHT 

Definition at line 40 of file autoscaledtokeyboardgraphicsview.h.

Constructor & Destructor Documentation

AutoScaledToKeyboardGraphicsView::AutoScaledToKeyboardGraphicsView ( QWidget *  parent,
DrawerBase drawer 
)

Constructor.

Parameters
parent: The parent widget
drawer: The drawer of this view

Definition at line 24 of file autoscaledtokeyboardgraphicsview.cpp.

AutoScaledToKeyboardGraphicsView::~AutoScaledToKeyboardGraphicsView ( )

Destructor.

Definition at line 32 of file autoscaledtokeyboardgraphicsview.cpp.

Member Function Documentation

void AutoScaledToKeyboardGraphicsView::highlightKey ( int  key)

Function that will highlight the given key.

Parameters
key: The key to highlight

There may only be one highlighted key.

Definition at line 44 of file autoscaledtokeyboardgraphicsview.cpp.

+ Here is the call graph for this function:

void AutoScaledToKeyboardGraphicsView::resizeEvent ( QResizeEvent *  event)
overrideprotected

Reimplemented to keep the visible view with the KeyboardGraphicsView.

Parameters
event: The event

Definition at line 68 of file autoscaledtokeyboardgraphicsview.cpp.

+ Here is the call graph for this function:

void AutoScaledToKeyboardGraphicsView::setKeyboard ( KeyboardGraphicsView keyboardgraphicsview)

Setter function for the keyboard.

Parameters
keyboardgraphicsview: The keyboard

Definition at line 37 of file autoscaledtokeyboardgraphicsview.cpp.

+ Here is the call graph for this function:

void AutoScaledToKeyboardGraphicsView::showEvent ( QShowEvent *  event)
overrideprotected

Reimplemented to keep the visible view with the KeyboardGraphicsView.

Parameters
event: The event

Definition at line 62 of file autoscaledtokeyboardgraphicsview.cpp.

+ Here is the call graph for this function:

Member Data Documentation

KeyboardGraphicsView* AutoScaledToKeyboardGraphicsView::mKeyboardGraphicsView
protected

Pointer to the KeyboardGraphicsView.

Definition at line 86 of file autoscaledtokeyboardgraphicsview.h.


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