- fix: Icon position not correct under hiPDI devices.

This commit is contained in:
Roy Qu 2023-10-15 12:45:31 +08:00
parent 526e73d27a
commit 5371311219
3 changed files with 8 additions and 3 deletions

View File

@ -12,6 +12,7 @@ Red Panda C++ Version 2.25
- Change: Empty project template won't auto create main.c/main.cpp
- enhancement: When creating project, warn user if the project folder is not empty.
- fix: Press '>' after '-' don't show completion suggestion info.
- fix: Icon position not correct under hiPDI devices.
Red Panda C++ Version 2.24

View File

@ -1074,8 +1074,9 @@ void Editor::onGutterPaint(QPainter &painter, int aLine, int X, int Y)
}
}
if (icon) {
X = 5;
Y += (this->textHeight() - icon->height()) / 2;
qreal dpr=icon->devicePixelRatioF();
X = 5/dpr;
Y += (this->textHeight() - icon->height()/dpr) / 2;
painter.drawPixmap(X,Y,*icon);
}
}

View File

@ -1298,7 +1298,10 @@ void CodeCompletionListItemDelegate::paint(QPainter *painter, const QStyleOption
QPixmap icon = mModel->statementIcon(index);
int x=option.rect.left();
if (!icon.isNull()) {
painter->drawPixmap(x+(option.rect.height()-icon.width())/2,option.rect.top()+(option.rect.height()-icon.height())/2,icon);
qreal dpr=icon.devicePixelRatioF();
int x1=x+(option.rect.height()-icon.width()/dpr)/2;
int y1=option.rect.top()+(option.rect.height()-icon.height()/dpr)/2;
painter->drawPixmap(x1,y1,icon);
x+=option.rect.height();
}
QString text = statement->command;