Planned maintenance has been done but it did not solve the problem. So work will continue on this and a new time for trying updates will be announced asap.
Draw on the center of widget
yugosonegi last edited by yugosonegi
I'm trying to draw an image on the center of a widget using the
paintEventand I'm doing like this:
QPainter painter; painter.drawPixmap(QPoint(width() / 2 - mLogotype->width() / 2, height() / 2 - mLogotype->height() / 2), mLogotype);
Is there a more convenient way for doing that?
You already have it in one line so there's little to be improved, but you can also do:
painter.drawPixmap((rect().bottomRight() - mLogotype.rect().bottomRight()) / 2, mLogotype);
Btw. In your example there's
QPointer. I think you meant
yugosonegi last edited by
@Chris-Kawa Yes, it's point and thank you for the improvement. :D