# HG changeset patch # User Teemu Piippo # Date 1627289445 -10800 # Node ID c0d064521ee0ac23946353d5c552fa0181182582 # Parent 5760cbb32bc022f625ac20c2853c39741b7ea580 refactor diff -r 5760cbb32bc0 -r c0d064521ee0 src/main.h --- 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(std::round(point.x())), static_cast(std::round(point.y()))}; } +inline QSizeF sizeToSizeF(const QSize& size) +{ + return {static_cast(size.width()), static_cast(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 diff -r 5760cbb32bc0 -r c0d064521ee0 src/ui/canvas.cpp --- 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(this->width()), static_cast(this->height())} - }; + const QRectF box {QPointF{0, 0}, sizeToSizeF(this->size())}; const QPointF p1 = this->modelToScreenCoordinates(glm::vec3{0, 0, 0}); static const struct