June 6, 2011

xolve xolve
Lab Rat
11 posts

QPainterPath set operations deprecated in Qt 4.8

 

From this blog post about Qt 4.8

http://labs.qt.nokia.com/2011/05/12/qt-modules-maturity-level-the-list/

It says that QPainterPath set operations are deprecated from now on. So what does this say about set operations on QPolygonF and other similar classes. I read their code and found that they used to use QPainterPath for implementing these methods.

6 replies

June 6, 2011

Franzk Franzk
Lab Rat
830 posts

If there is no statement about deprecating those, they will likely be changed into not using the painter path anymore, but don’t take my word for it.

 Signature 

“Horse sense is the thing a horse has which keeps it from betting on people.”—W.C. Fields

http://www.catb.org/~esr/faqs/smart-questions.html

June 6, 2011

sigrid sigrid
Lab Rat
144 posts

The set operations for QPolygonF and other similar classes are all deprecated too.

June 6, 2011

Franzk Franzk
Lab Rat
830 posts

That’s a clear answer :)

 Signature 

“Horse sense is the thing a horse has which keeps it from betting on people.”—W.C. Fields

http://www.catb.org/~esr/faqs/smart-questions.html

June 6, 2011

xolve xolve
Lab Rat
11 posts

Thanks @sigrid.

June 6, 2011

xolve xolve
Lab Rat
11 posts

@Franzk I was hoping the same.

July 19, 2011

wstokes wstokes
Lab Rat
1 posts

Hrmm, I just noticed these were being deprecated. I’m going to really miss QPainterPath::setElementPositionAt. I use it to warp text to a curve. For example:

  1. QString text = "Sample string";
  2.  
  3. QFont font;
  4. QFontMetricsF fontMetric(font);
  5.  
  6. qreal textWidth = fontMetric.boundingRect(text).width();
  7.  
  8. qreal circumfrance   = 2*PI*textRadius;
  9. qreal textSweepAngle = (360.0 * textWidth) / circumfrance;
  10.  
  11. path.addText(QPoint(0,0), scaledFont, text );
  12.  
  13. //warp points around a circle
  14. for (int i=0; i<path.elementCount(); i++)
  15. {
  16.   const QPainterPath::Element &e = path.elementAt(i);
  17.   qreal theta = MathTools::correctAngle(-90 + textSweepAngle*e.x / textWidth;
  18.   qreal r = textRadius - e.y;
  19.   path.setElementPositionAt(i, r*cos(theta), r*sin(theta));
  20. }

If QPainterPath::setelementPositionAt is going to be removed, won’t it be impossible to warp text around a curve in Qt5?

[EDIT: code formatting, please wrap in @-tags, Volker]

 
  ‹‹ [SOLVED]QTextDocument, table and table border width 1px.      Want to include MFC dialog in Qt application ››

You must log in to post a reply. Not a member yet? Register here!