Entropy Piano Tuner
1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
|
Class for a single item in a graphics view. More...
#include <graphicsitem.h>
Public Types | |
using | RoleType = std::uint32_t |
Type of a user role that can be set in a GraphicsItem (bitwise flag). More... | |
Public Member Functions | |
GraphicsItem (GraphicsViewAdapter *graphicsView) | |
Constructor. More... | |
virtual | ~GraphicsItem () |
Virtual Destructor. More... | |
void | setKeyIndexAndItemRole (int index, RoleType role) |
Short function for setting the key index and the role. More... | |
void | setKeyIndex (int index) |
Setter for mKeyIndex. More... | |
int | getKeyIndex () const |
Getter for mKeyIndex. More... | |
void | setItemRole (RoleType role) |
Setter function for mRole. More... | |
void | addItemRole (RoleType role) |
Bitwise add of role and mRole. More... | |
RoleType | getItemRole () const |
Getter for mRole. More... | |
GraphicsViewAdapter * | getGraphicsView () |
Getter for mGraphicsView. More... | |
virtual void | setPosition (double x, double y)=0 |
Function to set the position of the element. More... | |
virtual void | setZOrder (double z) |
Set the z order of the element (here implemented without function) More... | |
Protected Attributes | |
GraphicsViewAdapter * | mGraphicsView |
Pointer to the parent GraphicsViewAdapter. More... | |
int | mKeyIndex |
RoleType | mRole |
The index of this item to identify it with a key. More... | |
Class for a single item in a graphics view.
Whenever a new element is drawn in the GraphicsViewAdapter a new GraphicItem has to be created. This item will be usful whenever a single item has to be changed. For example, the tuning marks have to be moved during the calculation process.
You can set a key index to identify an item with a key and you can set a user-defined role that will be treated as bitwise flag. All of this is useful if you want to find a single item in the list of all items in a GraphicsViewAdapter.
A key index of -1 is allowed to indicate no link with a key. This is normally a global item.
The GUI implementation should define its own GraphicsItem and reimplement setPosition(float, float)
Whenever the GraphicsItem is changed the GraphicsViewAdapter implementation should redraw the corresponding element, but not the complete panel.
Definition at line 55 of file graphicsitem.h.
using GraphicsItem::RoleType = std::uint32_t |
Type of a user role that can be set in a GraphicsItem (bitwise flag).
Definition at line 62 of file graphicsitem.h.
GraphicsItem::GraphicsItem | ( | GraphicsViewAdapter * | graphicsView | ) |
Constructor.
It will automatically add this as new element to the GraphicsViewAdapter.
graphicsView | : The parent GraphicsViewAdapter |
Definition at line 31 of file graphicsitem.cpp.
|
virtual |
Virtual Destructor.
It will automatically remove this as element from the GraphicsViewAdapter.
Definition at line 44 of file graphicsitem.cpp.
|
inline |
Bitwise add of role and mRole.
role | : The role to add |
Definition at line 110 of file graphicsitem.h.
|
inline |
|
inline |
|
inline |
|
inline |
Setter function for mRole.
role | : The user defined role of the item |
Definition at line 104 of file graphicsitem.h.
|
inline |
Setter for mKeyIndex.
index | : The key index of the item |
Definition at line 92 of file graphicsitem.h.
void GraphicsItem::setKeyIndexAndItemRole | ( | int | index, |
RoleType | role | ||
) |
Short function for setting the key index and the role.
The function will all setItemRole(RoleType) and setKeyIndex(int).
index | : The key index of the item |
role | : The user defined item role |
Definition at line 53 of file graphicsitem.cpp.
|
pure virtual |
Function to set the position of the element.
This function should be reimplemented by an actual implementation of the element.
x | : The relative x coord |
y | : The relative y coord |
Implemented in GraphicsItemForQt.
|
inlinevirtual |
Set the z order of the element (here implemented without function)
z | : The z order |
Reimplemented in GraphicsItemForQt.
Definition at line 138 of file graphicsitem.h.
|
protected |
Pointer to the parent GraphicsViewAdapter.
Definition at line 142 of file graphicsitem.h.
|
protected |
Definition at line 143 of file graphicsitem.h.
|
protected |
The index of this item to identify it with a key.
Definition at line 144 of file graphicsitem.h.