refactor: Use SVG for cursor rendering

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-14 21:35:09 -07:00
parent dc7f3642b8
commit 91f1a0e02a
2 changed files with 7 additions and 6 deletions

View File

@@ -30,6 +30,8 @@ ViewportWidget::ViewportWidget(QWidget *parent)
m_toolIcons.insert(static_cast<int>(ApplicationController::ToolType::Line), new QSvgRenderer(QString(":/icons/line.svg"), this));
m_toolIcons.insert(static_cast<int>(ApplicationController::ToolType::Rectangle), new QSvgRenderer(QString(":/icons/rectangle.svg"), this));
m_toolIcons.insert(static_cast<int>(ApplicationController::ToolType::Circle), new QSvgRenderer(QString(":/icons/circle.svg"), this));
m_cursorRenderer = new QSvgRenderer(QString(":/icons/cursor.svg"), this);
}
ViewportWidget::~ViewportWidget()
@@ -400,12 +402,10 @@ void ViewportWidget::onActiveToolChanged(int tool)
QPainter painter(&cursorPixmap);
painter.setRenderHint(QPainter::Antialiasing);
// Draw arrow cursor manually
QPolygon arrowPolygon;
arrowPolygon << QPoint(0, 0) << QPoint(0, 11) << QPoint(4, 11) << QPoint(4, 16) << QPoint(7, 16) << QPoint(7, 11) << QPoint(11, 11);
painter.setPen(Qt::white);
painter.setBrush(Qt::black);
painter.drawPolygon(arrowPolygon);
// Render arrow cursor from SVG
if (m_cursorRenderer && m_cursorRenderer->isValid()) {
m_cursorRenderer->render(&painter, QRectF(0, 0, 16, 16));
}
// Render tool icon
const QSize iconSize(32, 32);