summaryrefslogtreecommitdiff
path: root/core/settings/light-and-power/calibration.cpp
Side-by-side diff
Diffstat (limited to 'core/settings/light-and-power/calibration.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/calibration.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/core/settings/light-and-power/calibration.cpp b/core/settings/light-and-power/calibration.cpp
index 307de1f..6a3360f 100644
--- a/core/settings/light-and-power/calibration.cpp
+++ b/core/settings/light-and-power/calibration.cpp
@@ -91,32 +91,32 @@ int Calibration::interval ( ) const
{
return m_interval;
}
void Calibration::setStartPoint ( const QPoint &p )
{
- m_p [0] = p;
+ m_p [0] = QPoint ( p. x ( ), m_scale. height ( ) - p. y ( ) - 1 );
checkPoints ( );
update ( );
}
QPoint Calibration::startPoint ( ) const
{
- return m_p [0];
+ return QPoint ( m_p [0]. x ( ), m_scale. height ( ) - m_p [0]. y ( ) - 1 );
}
void Calibration::setEndPoint ( const QPoint &p )
{
- m_p [1] = p;
+ m_p [1] = QPoint ( p. x ( ), m_scale. height ( ) - p. y ( ) - 1 );
checkPoints ( );
update ( );
}
QPoint Calibration::endPoint ( ) const
{
- return m_p [1];
+ return QPoint ( m_p [1]. x ( ), m_scale. height ( ) - m_p [1]. y ( ) - 1 );
}
void Calibration::checkPoints ( )
{
int dx = m_scale. width ( );
int dy = m_scale. height ( );
@@ -201,18 +201,18 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e )
if ( n [i] != m_p [i] ) {
r |= around ( nx [i], ny [i] );
r |= around ( ox [i], oy [i] );
m_p [i] = n [i];
if ( i == 0 ) {
- r |= QRect ( 0, 0, nx [0] - 0 + 1, ny [0] - 0 + 1 );
- r |= QRect ( 0, 0, ox [0] - 0 + 1, oy [0] - 0 + 1 );
+ r |= QRect ( 0, ny [0], nx [0] - 0 + 1, 1 );
+ r |= QRect ( 0, oy [0], ox [0] - 0 + 1, 1 );
}
else if ( i == 1 ) {
- r |= QRect ( nx [1], ny [1], width ( ) - nx [1], height ( ) - ny [1] );
- r |= QRect ( ox [1], oy [1], width ( ) - ox [1], height ( ) - oy [1] );
+ r |= QRect ( nx [1], ny [1], width ( ) - nx [1], 1 );
+ r |= QRect ( ox [1], oy [1], width ( ) - ox [1], 1 );
}
}
}
if ( r. isValid ( )) {
r |= QRect ( nx [0], ny [0], nx [1] - nx [0] + 1, ny [1] - ny [0] + 1 );
r |= QRect ( ox [0], oy [0], ox [1] - ox [0] + 1, oy [1] - oy [0] + 1 );
@@ -250,14 +250,13 @@ void Calibration::paintEvent ( QPaintEvent * )
int dy = y1 - y0;
int ex = x0, ey = y0;
p. setPen ( g. highlight ( ));
- p. drawLine ( BRD, BRD, ex, BRD );
- p. drawLine ( ex, BRD, ex, ey );
+ p. drawLine ( BRD, ey, ex, ey );
for ( int i = 1; i < m_steps; i++ ) {
int fx = x0 + dx * i / m_steps;
int fy = y0 + dy * i / ( m_steps - 1 );
p. drawLine ( ex, ey, fx, ey );