#ifndef RECTANGLE_H #define RECTANGLE_H //Qt #include #include #include #include #include #include #include #include #include #include #include #include class Rectangle { public: Rectangle(){ _scalex = 1; _scaley = 1; } Rectangle(double scalex,double scaley){ _scalex = scalex; _scaley = scaley; } void paint(QPixmap&mp, QPaintEvent *event = nullptr){ QPainter painter; painter.begin(&mp); painter.setRenderHint(QPainter::Antialiasing, true); painter.scale(_scalex,_scaley); painter.setPen(QPen(Qt::black, 0.8)); QRect r(_topLeft,_bottomRight); _rect = r; painter.drawRect(_rect); painter.end(); } double scalex() const { return _scalex; } void setScalex(double scalex) { _scalex = scalex; } double scaley() const { return _scaley; } void setScaley(double scaley) { _scaley = scaley; } QPoint topLeft() const { return _topLeft; } void setTopLeft(const QPoint &topLeft) { _topLeft = topLeft; } QPoint bottomRight() const { return _bottomRight; } void setBottomRight(const QPoint &bottomRight) { _bottomRight = bottomRight; } QColor rectColor() const { return _rectColor; } void setRectColor(const QColor &rectColor) { _rectColor = rectColor; } private: QPoint _topLeft; QPoint _bottomRight; QColor _rectColor; double _scalex; double _scaley; QRect _rect; }; #endif // RECTANGLE_H