Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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.



  • 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.



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



  • That's a clear answer :)



  • Thanks @sigrid.



  • @Franzk I was hoping the same.



  • 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:

    @
    QString text = "Sample string";

    QFont font;
    QFontMetricsF fontMetric(font);

    qreal textWidth = fontMetric.boundingRect(text).width();

    qreal circumfrance = 2PItextRadius;
    qreal textSweepAngle = (360.0 * textWidth) / circumfrance;

    QPainterPath path;
    path.addText(QPoint(0,0), scaledFont, text );

    //warp points around a circle
    for (int i=0; i<path.elementCount(); i++)
    {
    const QPainterPath::Element &e = path.elementAt(i);
    qreal theta = MathTools::correctAngle(-90 + textSweepAnglee.x / textWidth;
    qreal r = textRadius - e.y;
    path.setElementPositionAt(i, r
    cos(theta), r*sin(theta));
    }
    @

    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]


Log in to reply