comparison widgets/LevelPanWidget.cpp @ 1307:5af5c611f4cb

Improve level-pan rendering quality on non-retina OSX
author Chris Cannam <cannam@all-day-breakfast.com>
date Tue, 26 Jun 2018 08:35:49 +0100
parents 5db672d6de4f
children
comparison
equal deleted inserted replaced
1306:5db672d6de4f 1307:5af5c611f4cb
348 } 348 }
349 349
350 QSizeF 350 QSizeF
351 LevelPanWidget::cellLightSize(QRectF rect) const 351 LevelPanWidget::cellLightSize(QRectF rect) const
352 { 352 {
353 double extent = 3. / 4.; 353 double extent = 0.7;
354 QSizeF cs = cellSize(rect); 354 QSizeF cs = cellSize(rect);
355 double m = std::min(cs.width(), cs.height()); 355 double m = std::min(cs.width(), cs.height());
356 return QSizeF(m * extent, m * extent); 356 return QSizeF(m * extent, m * extent);
357 } 357 }
358 358
385 385
386 QRectF 386 QRectF
387 LevelPanWidget::cellOutlineRect(QRectF rect, int row, int col) const 387 LevelPanWidget::cellOutlineRect(QRectF rect, int row, int col) const
388 { 388 {
389 QRectF clr = cellLightRect(rect, row, col); 389 QRectF clr = cellLightRect(rect, row, col);
390 double adj = thinLineWidth(rect)/2; 390 double adj = thinLineWidth(rect)/2 + 0.5;
391 return clr.adjusted(-adj, -adj, adj, adj); 391 return clr.adjusted(-adj, -adj, adj, adj);
392 } 392 }
393 393
394 QColor 394 QColor
395 LevelPanWidget::cellToColour(int cell) const 395 LevelPanWidget::cellToColour(int cell) const
529 clr.y() + clr.height()/4, 529 clr.y() + clr.height()/4,
530 clr.width(), 530 clr.width(),
531 clr.height()/4)); 531 clr.height()/4));
532 } else { 532 } else {
533 paint.setPen(Qt::NoPen); 533 paint.setPen(Qt::NoPen);
534 if (outline == half) { 534 QRectF cor = cellOutlineRect(rect, cell, pan);
535 clr = cellOutlineRect(rect, cell, pan); 535 paint.drawRect(QRectF(cor.x(),
536 } 536 cor.y() - 0.5,
537 paint.drawRect(QRectF(clr.x(), 537 cor.width(),
538 clr.y() - 0.5, 538 cor.height()/2));
539 clr.width(),
540 clr.height()/2));
541 } 539 }
542 } 540 }
543 541
544 if (outline == full || fill == full) { 542 if (outline == full || fill == full) {
545 543