Commit 46d01106 authored by Simon Eugster's avatar Simon Eugster
Browse files

Vectorscope change: Show angle on mouse hover

svn path=/trunk/kdenlive/; revision=4588
parent c471a29f
......@@ -99,7 +99,7 @@ void ColorPlaneExport::slotUpdateDisplays()
switch (cbColorspace->itemData(cbColorspace->currentIndex()).toInt()) {
case CPE_YUV_Y:
lblColNr->setText(i18n("%1 °", QString::number(sliderColor->value())));
lblColNr->setText(i18n("%1°", QString::number(sliderColor->value())));
break;
default:
lblColNr->setText(QString::number(sliderColor->value()));
......
......@@ -481,12 +481,12 @@ void Vectorscope::paintEvent(QPaintEvent *)
if (circleEnabled) {
// Mouse moved: Draw a circle over the scope
int dx = centerPoint.x()-mousePos.x();
int dy = centerPoint.y()-mousePos.y();
int dx = -centerPoint.x()+mousePos.x();
int dy = centerPoint.y()-mousePos.y();
QPoint reference = mapToCanvas(m_scopeRect, QPointF(1,0));
int r = sqrt(dx*dx + dy*dy);
float r = sqrt(dx*dx + dy*dy);
float percent = (float) 100*r/SCALING/m_scaling/(reference.x() - centerPoint.x());
switch (backgroundMode->itemData(backgroundMode->currentIndex()).toInt()) {
......@@ -497,9 +497,12 @@ void Vectorscope::paintEvent(QPaintEvent *)
davinci.setPen(penDark);
break;
}
davinci.drawEllipse(centerPoint, r,r);
davinci.drawEllipse(centerPoint, (int)r, (int)r);
davinci.setPen(penThin);
davinci.drawText(m_scopeRect.bottomRight()-QPoint(40,0), QVariant((int)percent).toString().append(" %"));
davinci.drawText(m_scopeRect.bottomRight()-QPoint(40,0), i18n("%1 \%", QString::number(percent, 'f', 0)));
float angle = copysign(acos(dx/r)*180/M_PI, dy);
davinci.drawText(m_scopeRect.bottomLeft()+QPoint(10,0), i18n("%1°", QString::number(angle, 'f', 1)));
circleEnabled = false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment