Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPainterPath , subtracted() is not working in some cases
Qt 6.12 LTS is out! See what's new in the release blog

QPainterPath , subtracted() is not working in some cases

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt
    • Unsolved