Lots of fixes and added more dialogs
This commit is contained in:
+25
-3
@@ -27,11 +27,33 @@ void DrawingCanvasWidget::setScale(float scale)
|
||||
|
||||
void DrawingCanvasWidget::paintEvent(QPaintEvent *ev)
|
||||
{
|
||||
QWidget::paintEvent(ev);
|
||||
|
||||
if (!m_pixmap)
|
||||
{
|
||||
QWidget::paintEvent(ev);
|
||||
return;
|
||||
}
|
||||
|
||||
QBrush brush;
|
||||
{
|
||||
QPixmap pixmap{32, 32};
|
||||
{
|
||||
QPainter painter{&pixmap};
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(Qt::gray);
|
||||
painter.drawRect(0, 0, 16, 16);
|
||||
painter.drawRect(16, 16, 16, 16);
|
||||
painter.setBrush(Qt::white);
|
||||
painter.drawRect(0, 16, 16, 16);
|
||||
painter.drawRect(16, 0, 16, 16);
|
||||
}
|
||||
brush.setTexture(std::move(pixmap));
|
||||
}
|
||||
|
||||
QPainter painter{this};
|
||||
painter.drawPixmap(QRect{QPoint{}, m_pixmap->size() * m_scale}, *m_pixmap);
|
||||
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(std::move(brush));
|
||||
painter.drawRect(rect());
|
||||
|
||||
painter.drawPixmap(rect(), *m_pixmap);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user