Mon, 26 Jul 2021 11:50:45 +0300
refactor
src/main.h | file | annotate | diff | comparison | revisions | |
src/ui/canvas.cpp | file | annotate | diff | comparison | revisions |
--- a/src/main.h Sun Jul 25 20:39:21 2021 +0300 +++ b/src/main.h Mon Jul 26 11:50:45 2021 +0300 @@ -125,6 +125,11 @@ return {static_cast<int>(std::round(point.x())), static_cast<int>(std::round(point.y()))}; } +inline QSizeF sizeToSizeF(const QSize& size) +{ + return {static_cast<qreal>(size.width()), static_cast<qreal>(size.height())}; +} + /** * \brief Hints to the specified vector that a certain amount of new elements are going to be added. * \param vector vector to consider
--- a/src/ui/canvas.cpp Sun Jul 25 20:39:21 2021 +0300 +++ b/src/ui/canvas.cpp Mon Jul 26 11:50:45 2021 +0300 @@ -194,10 +194,7 @@ } painter.drawText(position, text); }; - const QRectF box { - QPointF{0, 0}, - QPointF{static_cast<qreal>(this->width()), static_cast<qreal>(this->height())} - }; + const QRectF box {QPointF{0, 0}, sizeToSizeF(this->size())}; const QPointF p1 = this->modelToScreenCoordinates(glm::vec3{0, 0, 0}); static const struct