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

QPainterPath , subtracted() is not working in some cases



  • @QPainterPath path;
    QPainterPath path;
    path.moveTo(100,200);
    path.lineTo(250,200);
    path.moveTo(250,200);
    path.lineTo(300,200);
    painter->drawPath( path );

    QPainterPath path2;
    QPen pen2 ( QBrush(Qt::red), 6 );
    painter->setPen( pen2 );
    painter->setBrush(brush());
    path2.moveTo(120,200);
    path2.lineTo(260,200);
    painter->drawPath( path2 );

    QPen pen3 ( QBrush(Qt::green), 3 );
    painter->setPen( pen3 );
    painter->setBrush(brush());
    QPainterPath popo = path.subtracted( path2 );

    if ( popo != path )
    painter->drawPath( popo );@

    NOTE:: QPainterPath::subtracted is doing fill area's subtraction. Lines don't have filled area at all then it's not working as i expect. Anyway is there any idea how can i subtract which is consisted lines QPainterPath with another QPainterPath which is also consisted lines ..


Log in to reply