aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt/ScintillaEditBase/PlatQt.cpp
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-03-19 21:03:17 +1100
committerNeil <nyamatongwe@gmail.com>2021-03-19 21:03:17 +1100
commit216fca2d218c3e0dcb5cdb4273cfb609da06cbd2 (patch)
tree44e1769b98acee672f4b4cb6cb2f42ce942faec5 /qt/ScintillaEditBase/PlatQt.cpp
parent20bb1c7c0f6931819745d9756ab14246c20c4e9f (diff)
downloadscintilla-mirror-216fca2d218c3e0dcb5cdb4273cfb609da06cbd2.tar.gz
Support strokeWidth and float cornerSize in AlphaRectangle. Use FillStroke
instead of separate colour and alpha arguments.
Diffstat (limited to 'qt/ScintillaEditBase/PlatQt.cpp')
-rw-r--r--qt/ScintillaEditBase/PlatQt.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp
index 37fc409f7..a8553e658 100644
--- a/qt/ScintillaEditBase/PlatQt.cpp
+++ b/qt/ScintillaEditBase/PlatQt.cpp
@@ -390,6 +390,38 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc,
}
}
+void SurfaceImpl::AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStroke fillStroke)
+{
+ QColor qFill = QColorFromColourAlpha(fillStroke.fill.colour);
+ QBrush brushFill(qFill);
+ GetPainter()->setBrush(brushFill);
+ if (fillStroke.fill.colour == fillStroke.stroke.colour) {
+ painter->setPen(Qt::NoPen);
+ QRectF rect = QRectFFromPRect(rc);
+ if (cornerSize > 0.0f) {
+ // A radius of 1 shows no curve so add 1
+ qreal radius = cornerSize+1;
+ GetPainter()->drawRoundedRect(rect, radius, radius);
+ } else {
+ GetPainter()->fillRect(rect, brushFill);
+ }
+ } else {
+ QColor qOutline = QColorFromColourAlpha(fillStroke.stroke.colour);
+ QPen penOutline(qOutline);
+ penOutline.setWidthF(fillStroke.stroke.width);
+ GetPainter()->setPen(penOutline);
+
+ QRectF rect = QRectFFromPRect(rc.Inset(fillStroke.stroke.width / 2));
+ if (cornerSize > 0.0f) {
+ // A radius of 1 shows no curve so add 1
+ qreal radius = cornerSize+1;
+ GetPainter()->drawRoundedRect(rect, radius, radius);
+ } else {
+ GetPainter()->drawRect(rect);
+ }
+ }
+}
+
void SurfaceImpl::GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops, GradientOptions options) {
QRectF rect = QRectFFromPRect(rc);
QLinearGradient linearGradient;