Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Learning
  3. Qt in Education
  4. How to remove extra margins arounding a QPixmap?
Forum Updated to NodeBB v4.3 + New Features

How to remove extra margins arounding a QPixmap?

Scheduled Pinned Locked Moved Qt in Education
1 Posts 1 Posters 1.4k 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.
  • S Offline
    S Offline
    sarina95
    wrote on last edited by
    #1

    I draw a QRectF in the paint function of my class and set a QPixmap as brush for it. I build an object from a class containing this QRectF. When I put this item in my scene and set background for the scene the QRectF appears. It also occurs for a QPixmap that I add to the scene. What can I do to remove the extra margins?
    @
    void MyQgraphicsObject::paint(QPainter *painter, )
    {
    QRectF rec(0,0,50,60);
    QPixmap pi(":picture/im/super.jpg");
    pi=pi.scaled(50,60);
    painter->setBrush(QBrush(pi));
    painter->setPen(Qt::NoPen);
    painter->drawRoundedRect(rec,10,10);
    }
    ////////////////////
    QPixmap a(":picture/im/cloud.jpg");
    scene->addPixmap(a);
    scene->setbackground(Qt::blue);@

    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 Extensions
    • Unsolved