papereditpainter.cpp 481 B

12345678910111213141516171819202122
  1. #include "papereditpainter.h"
  2. #include "qpainter.h"
  3. CPaperEditPainter::CPaperEditPainter(QWidget *parent)
  4. : QWidget(parent)
  5. {
  6. m_bgimage = nullptr;
  7. }
  8. CPaperEditPainter::~CPaperEditPainter()
  9. {
  10. }
  11. void CPaperEditPainter::paintEvent(QPaintEvent *e)
  12. {
  13. QRect rc(this->rect());
  14. QPainter painter(this);
  15. painter.setRenderHint(QPainter::Antialiasing);
  16. painter.translate(m_offset->x(), m_offset->y());
  17. painter.scale(*m_room, *m_room);
  18. painter.drawImage(QPoint(0, 0), *m_bgimage);
  19. }