optimize wave underline width

This commit is contained in:
Roy Qu 2024-03-03 18:55:02 +08:00
parent 8561a035ae
commit 43658bc873
1 changed files with 4 additions and 0 deletions

View File

@ -467,6 +467,8 @@ void QSynEditPainter::paintEditAreas(const EditingAreaList &areaList)
setDrawingColors(false); setDrawingColors(false);
for (const PEditingArea& p:areaList) { for (const PEditingArea& p:areaList) {
int penWidth = std::max(1,mEdit->font().pixelSize() / 15); int penWidth = std::max(1,mEdit->font().pixelSize() / 15);
if (p->type == EditingAreaType::eatWaveUnderLine)
penWidth = std::max(1,mEdit->font().pixelSize() / 21);
if (p->beginX > mRight) if (p->beginX > mRight)
continue; continue;
if (p->endX < mLeft) if (p->endX < mLeft)
@ -488,6 +490,8 @@ void QSynEditPainter::paintEditAreas(const EditingAreaList &areaList)
mPainter->setBrush(Qt::NoBrush); mPainter->setBrush(Qt::NoBrush);
switch(p->type) { switch(p->type) {
case EditingAreaType::eatRectangleBorder: case EditingAreaType::eatRectangleBorder:
rc.setTop(rc.top()+penWidth/2);
rc.setBottom(rc.bottom()-penWidth/2);
mPainter->drawRect(rc); mPainter->drawRect(rc);
break; break;
case EditingAreaType::eatUnderLine: { case EditingAreaType::eatUnderLine: {