comparison view/View.cpp @ 1270:7527701c8076

Make selection extents more visible on hi-dpi
author Chris Cannam
date Thu, 19 Apr 2018 14:36:16 +0100
parents a34a2a25907c
children 61418c112281
comparison
equal deleted inserted replaced
1269:f2894944c6b8 1270:7527701c8076
2021 #endif 2021 #endif
2022 2022
2023 bool illuminateThis = 2023 bool illuminateThis =
2024 (illuminateFrame >= 0 && i->contains(illuminateFrame)); 2024 (illuminateFrame >= 0 && i->contains(illuminateFrame));
2025 2025
2026 paint.setPen(QColor(150, 150, 255)); 2026 double h = height();
2027 double penWidth = PaintAssistant::scalePenWidth(1.0);
2028 double half = penWidth/2.0;
2029
2030 paint.setPen(QPen(QColor(150, 150, 255), penWidth));
2027 2031
2028 if (translucent && shouldLabelSelections()) { 2032 if (translucent && shouldLabelSelections()) {
2029 paint.drawRect(p0, -1, p1 - p0, height() + 1); 2033 paint.drawRect(QRectF(p0, -penWidth, p1 - p0, h + 2*penWidth));
2030 } else { 2034 } else {
2031 // Make the top & bottom lines of the box visible if we 2035 // Make the top & bottom lines of the box visible if we
2032 // are lacking some of the other visual cues. There's no 2036 // are lacking some of the other visual cues. There's no
2033 // particular logic to this, it's just a question of what 2037 // particular logic to this, it's just a question of what
2034 // I happen to think looks nice. 2038 // I happen to think looks nice.
2035 paint.drawRect(p0, 0, p1 - p0, height() - 1); 2039 paint.drawRect(QRectF(p0, half, p1 - p0, h - penWidth));
2036 } 2040 }
2037 2041
2038 if (illuminateThis) { 2042 if (illuminateThis) {
2039 paint.save(); 2043 paint.save();
2040 paint.setPen(QPen(getForeground(), 2)); 2044 penWidth = PaintAssistant::scalePenWidth(2.0);
2045 half = penWidth/2.0;
2046 paint.setPen(QPen(getForeground(), penWidth));
2041 if (closeToLeft) { 2047 if (closeToLeft) {
2042 paint.drawLine(p0, 1, p1, 1); 2048 paint.drawLine(QLineF(p0, half, p1, half));
2043 paint.drawLine(p0, 0, p0, height()); 2049 paint.drawLine(QLineF(p0, half, p0, h - half));
2044 paint.drawLine(p0, height() - 1, p1, height() - 1); 2050 paint.drawLine(QLineF(p0, h - half, p1, h - half));
2045 } else if (closeToRight) { 2051 } else if (closeToRight) {
2046 paint.drawLine(p0, 1, p1, 1); 2052 paint.drawLine(QLineF(p0, half, p1, half));
2047 paint.drawLine(p1, 0, p1, height()); 2053 paint.drawLine(QLineF(p1, half, p1, h - half));
2048 paint.drawLine(p0, height() - 1, p1, height() - 1); 2054 paint.drawLine(QLineF(p0, h - half, p1, h - half));
2049 } else { 2055 } else {
2050 paint.setBrush(Qt::NoBrush); 2056 paint.setBrush(Qt::NoBrush);
2051 paint.drawRect(p0, 1, p1 - p0, height() - 2); 2057 paint.drawRect(QRectF(p0, half, p1 - p0, h - penWidth));
2052 } 2058 }
2053 paint.restore(); 2059 paint.restore();
2054 } 2060 }
2055 2061
2056 if (sampleRate && shouldLabelSelections() && m_manager && 2062 if (sampleRate && shouldLabelSelections() && m_manager &&