|
|
|
|
|
|
|
|
#include "CircleOfFifths.h" |
|
|
|
|
|
#include "MainWindow.h" |
|
|
|
|
|
#include <QColorDialog> |
|
|
|
|
|
|
|
|
|
|
|
CircleOfFifths::CircleOfFifths(qreal x, qreal y, qreal w, qreal h, MainWindow * parent): QGraphicsScene(x,y,w,h){ |
|
|
|
|
|
addItem(circleElements[0] = new CircleElement(parent->colorScale.getToneByName("C"))); |
|
|
|
|
|
addItem(circleElements[1] = new CircleElement(parent->colorScale.getToneByName("G"))); |
|
|
|
|
|
addItem(circleElements[2] = new CircleElement(parent->colorScale.getToneByName("D"))); |
|
|
|
|
|
addItem(circleElements[3] = new CircleElement(parent->colorScale.getToneByName("A"))); |
|
|
|
|
|
addItem(circleElements[4] = new CircleElement(parent->colorScale.getToneByName("E"))); |
|
|
|
|
|
addItem(circleElements[5] = new CircleElement(parent->colorScale.getToneByName("H"))); |
|
|
|
|
|
addItem(circleElements[6] = new CircleElement(parent->colorScale.getToneByName("Fis"))); |
|
|
|
|
|
addItem(circleElements[7] = new CircleElement(parent->colorScale.getToneByName("Cis"))); |
|
|
|
|
|
addItem(circleElements[8] = new CircleElement(parent->colorScale.getToneByName("Gis"))); |
|
|
|
|
|
addItem(circleElements[9] = new CircleElement(parent->colorScale.getToneByName("Dis"))); |
|
|
|
|
|
addItem(circleElements[10] = new CircleElement(parent->colorScale.getToneByName("Ais"))); |
|
|
|
|
|
addItem(circleElements[11] = new CircleElement(parent->colorScale.getToneByName("F"))); |
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<12; i++) |
|
|
|
|
|
QObject::connect(circleElements[i]->getTone(), &Tone::colorchanged, circleElements[i], &CircleElement::redraw); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
void CircleOfFifths::mousePressEvent(QGraphicsSceneMouseEvent *event){ |
|
|
|
|
|
QString title = "Bitte Farbe wählen für Ton "; |
|
|
|
|
|
if(event->button() == Qt::LeftButton){ |
|
|
|
|
|
for(int i=0; i<12; i++){ |
|
|
|
|
|
if(circleElements[i]->sceneBoundingRect().contains(event->scenePos())){ |
|
|
|
|
|
circleElements[i]->getTone()->setColor( |
|
|
|
|
|
QColorDialog::getColor( |
|
|
|
|
|
circleElements[i]->getTone()->getColor(), |
|
|
|
|
|
nullptr, |
|
|
|
|
|
title.append(circleElements[i]->getTone()->getName()), |
|
|
|
|
|
QColorDialog::DontUseNativeDialog |
|
|
|
|
|
) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
}} |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
CircleElement * CircleOfFifths::getCircleElement(int number)const{ |
|
|
|
|
|
return circleElements[number]; |
|
|
|
|
|
}; |
|
|
|