Changeset View
Changeset View
Standalone View
Standalone View
src/TerminalDisplay.cpp
Show First 20 Lines • Show All 1058 Lines • ▼ Show 20 Line(s) | |||||
1059 | { | 1059 | { | ||
1060 | // don't draw cursor which is currently blinking | 1060 | // don't draw cursor which is currently blinking | ||
1061 | if (_cursorBlinking) { | 1061 | if (_cursorBlinking) { | ||
1062 | return; | 1062 | return; | ||
1063 | } | 1063 | } | ||
1064 | 1064 | | |||
1065 | // shift rectangle top down one pixel to leave some space | 1065 | // shift rectangle top down one pixel to leave some space | ||
1066 | // between top and bottom | 1066 | // between top and bottom | ||
1067 | QRect cursorRect = rect.adjusted(0, 1, 0, 0); | 1067 | QRectF cursorRect = rect.adjusted(0, 1, 0, 0); | ||
1068 | 1068 | | |||
1069 | QColor cursorColor = _cursorColor.isValid() ? _cursorColor : foregroundColor; | 1069 | QColor cursorColor = _cursorColor.isValid() ? _cursorColor : foregroundColor; | ||
1070 | painter.setPen(cursorColor); | 1070 | painter.setPen(cursorColor); | ||
1071 | 1071 | | |||
1072 | if (_cursorShape == Enum::BlockCursor) { | 1072 | if (_cursorShape == Enum::BlockCursor) { | ||
1073 | // draw the cursor outline, adjusting the area so that | 1073 | // draw the cursor outline, adjusting the area so that | ||
1074 | // it is draw entirely inside 'rect' | 1074 | // it is draw entirely inside 'rect' | ||
1075 | int penWidth = qMax(1, painter.pen().width()); | 1075 | int penWidth = qMax(1, painter.pen().width()); | ||
1076 | painter.drawRect(cursorRect.adjusted(penWidth / 2, | 1076 | painter.drawRect(cursorRect.adjusted(penWidth / 2 + 0.5, | ||
1077 | penWidth / 2, | 1077 | penWidth / 2 + 0.5, | ||
1078 | - penWidth / 2 - penWidth % 2, | 1078 | - penWidth / 2 - penWidth % 2 + 0.5, | ||
1079 | - penWidth / 2 - penWidth % 2)); | 1079 | - penWidth / 2 - penWidth % 2 + 0.5)); | ||
1080 | 1080 | | |||
1081 | // draw the cursor body only when the widget has focus | 1081 | // draw the cursor body only when the widget has focus | ||
1082 | if (hasFocus()) { | 1082 | if (hasFocus()) { | ||
1083 | painter.fillRect(cursorRect, cursorColor); | 1083 | painter.fillRect(cursorRect, cursorColor); | ||
1084 | 1084 | | |||
1085 | if (!_cursorColor.isValid()) { | 1085 | if (!_cursorColor.isValid()) { | ||
1086 | // invert the color used to draw the text to ensure that the character at | 1086 | // invert the color used to draw the text to ensure that the character at | ||
1087 | // the cursor position is readable | 1087 | // the cursor position is readable | ||
▲ Show 20 Lines • Show All 3041 Lines • Show Last 20 Lines |