I am learning QT and am asking a quick question:
What would be the best way to draw a circle with radius r with a center point at x, y?
Thanks!
In a paintEvent use this:
paintEvent
http://doc.qt.io/qt-4.8/qpainter.html#drawEllipse
http://doc.qt.io/qt-4.8/qgraphicsscene.html#addEllipse
In a QGraphicsView / QGraphicsScene use this:
QGraphicsView
QGraphicsScene
http://doc.qt.io/qt-4.8/qgraphicsellipseitem.html
The last link listed is an overloaded method that allows you to enter a center point with the indicated two indicated radii.
void QPainter::drawEllipse ( const QPointF & center, qreal rx, qreal ry )
So your code will look something like this:
// inside MyWidget::paintEvent() painter.drawEllipse(QPointF(x,y), radius, radius);
Hope this helps.
Source: https://habr.com/ru/post/948359/More articles:Cancel MSI without showing the Abort Installation dialog box - windows-installerhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/948355/modular-maven-projects-and-multiple-git-repositories&usg=ALkJrhg2s6S2-KScMXk1vuyY2VaQ1SBcmAHow do you link to DLP EPPlus? - dllImplementing a database queue using yield return - c #Python asks urlencode not working? - pythonVim errorformat: include part of expression in message string - vimRemove common letters in strings - pythonwpf button background color - buttonCSS hover effect does not work - htmlResponsive text alignment on Twitter Bootstrap 2.x - twitter-bootstrapAll Articles