diff options
Diffstat (limited to 'qt')
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 31 | ||||
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.h | 13 |
2 files changed, 26 insertions, 18 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index d61abf7b2..248fcf194 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -249,6 +249,13 @@ void SurfaceImpl::PenColour(ColourDesired fore) GetPainter()->setPen(penOutline); } +void SurfaceImpl::PenColour(ColourAlpha fore) +{ + QPen penOutline(QColorFromColourAlpha(fore)); + penOutline.setCapStyle(Qt::FlatCap); + GetPainter()->setPen(penOutline); +} + void SurfaceImpl::PenColourWidth(ColourAlpha fore, XYPOSITION strokeWidth) { QPen penOutline(QColorFromColourAlpha(fore)); penOutline.setCapStyle(Qt::FlatCap); @@ -639,13 +646,13 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc, const Font *font, XYPOSITION ybase, std::string_view text, - ColourDesired fore, - ColourDesired back) + ColourAlpha fore, + ColourAlpha back) { SetFont(font); PenColour(fore); - GetPainter()->setBackground(QColorFromCA(back)); + GetPainter()->setBackground(QColorFromColourAlpha(back)); GetPainter()->setBackgroundMode(Qt::OpaqueMode); QString su = UnicodeFromText(codec, text); GetPainter()->drawText(QPointF(rc.left, ybase), su); @@ -655,8 +662,8 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, const Font *font, XYPOSITION ybase, std::string_view text, - ColourDesired fore, - ColourDesired back) + ColourAlpha fore, + ColourAlpha back) { SetClip(rc); DrawTextNoClip(rc, font, ybase, text, fore, back); @@ -667,7 +674,7 @@ void SurfaceImpl::DrawTextTransparent(PRectangle rc, const Font *font, XYPOSITION ybase, std::string_view text, - ColourDesired fore) + ColourAlpha fore) { SetFont(font); PenColour(fore); @@ -751,13 +758,13 @@ void SurfaceImpl::DrawTextNoClipUTF8(PRectangle rc, const Font *font, XYPOSITION ybase, std::string_view text, - ColourDesired fore, - ColourDesired back) + ColourAlpha fore, + ColourAlpha back) { SetFont(font); PenColour(fore); - GetPainter()->setBackground(QColorFromCA(back)); + GetPainter()->setBackground(QColorFromColourAlpha(back)); GetPainter()->setBackgroundMode(Qt::OpaqueMode); QString su = QString::fromUtf8(text.data(), static_cast<int>(text.length())); GetPainter()->drawText(QPointF(rc.left, ybase), su); @@ -767,8 +774,8 @@ void SurfaceImpl::DrawTextClippedUTF8(PRectangle rc, const Font *font, XYPOSITION ybase, std::string_view text, - ColourDesired fore, - ColourDesired back) + ColourAlpha fore, + ColourAlpha back) { SetClip(rc); DrawTextNoClip(rc, font, ybase, text, fore, back); @@ -779,7 +786,7 @@ void SurfaceImpl::DrawTextTransparentUTF8(PRectangle rc, const Font *font, XYPOSITION ybase, std::string_view text, - ColourDesired fore) + ColourAlpha fore) { SetFont(font); PenColour(fore); diff --git a/qt/ScintillaEditBase/PlatQt.h b/qt/ScintillaEditBase/PlatQt.h index 1fc476129..c9424378e 100644 --- a/qt/ScintillaEditBase/PlatQt.h +++ b/qt/ScintillaEditBase/PlatQt.h @@ -102,6 +102,7 @@ public: int Supports(int feature) noexcept override; bool Initialised() override; void PenColour(ColourDesired fore) override; + void PenColour(ColourAlpha fore); void PenColourWidth(ColourAlpha fore, XYPOSITION strokeWidth); int LogPixelsY() override; int PixelDivisions() override; @@ -139,21 +140,21 @@ public: std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) override; void DrawTextNoClip(PRectangle rc, const Font *font, XYPOSITION ybase, - std::string_view text, ColourDesired fore, ColourDesired back) override; + std::string_view text, ColourAlpha fore, ColourAlpha back) override; void DrawTextClipped(PRectangle rc, const Font *font, XYPOSITION ybase, - std::string_view text, ColourDesired fore, ColourDesired back) override; + std::string_view text, ColourAlpha fore, ColourAlpha back) override; void DrawTextTransparent(PRectangle rc, const Font *font, XYPOSITION ybase, - std::string_view text, ColourDesired fore) override; + std::string_view text, ColourAlpha fore) override; void MeasureWidths(const Font *font, std::string_view text, XYPOSITION *positions) override; XYPOSITION WidthText(const Font *font, std::string_view text) override; void DrawTextNoClipUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, - std::string_view text, ColourDesired fore, ColourDesired back) override; + std::string_view text, ColourAlpha fore, ColourAlpha back) override; void DrawTextClippedUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, - std::string_view text, ColourDesired fore, ColourDesired back) override; + std::string_view text, ColourAlpha fore, ColourAlpha back) override; void DrawTextTransparentUTF8(PRectangle rc, const Font *font_, XYPOSITION ybase, - std::string_view text, ColourDesired fore) override; + std::string_view text, ColourAlpha fore) override; void MeasureWidthsUTF8(const Font *font_, std::string_view text, XYPOSITION *positions) override; XYPOSITION WidthTextUTF8(const Font *font_, std::string_view text) override; |