Dear QtCummunity,
I would like to draw a custom item like the attached image. Request your suggestion please.
Qt Code:
{ // Please suggest me }To copy to clipboard, switch view to plain text mode
Dear QtCummunity,
I would like to draw a custom item like the attached image. Request your suggestion please.
Qt Code:
{ // Please suggest me }To copy to clipboard, switch view to plain text mode
Last edited by saifulkhan; 12th March 2013 at 19:24.
Use QPainter::drawLine(), QPainter::drawRect(), and QPainter::drawPolygon() (for the triangle). Use whatever dimensions are the most convenient for your application, since all of the transformations to set position, scale, and rotation are done by the parent of your MyItem.
Do you want to paint it as a single item? then use QPainterPath(s)
You could also use multiple QGrpahicsLineItems, and use QPen and QBrush settings as needed.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
saifulkhan (17th March 2013)
Bookmarks