Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. setDotsPerMeterX() function cannot work on my image
Forum Updated to NodeBB v4.3 + New Features

setDotsPerMeterX() function cannot work on my image

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 187 Views
  • 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.
  • R Offline
    R Offline
    RayX
    wrote on last edited by
    #1

    Hi,
    I want to use setDotsPerMeterX() function to change the DPI for the image, but it doesn't work, who can help me? thanks!

    the following is the test code:
    QImage img(100,100,QImage::Format_Mono);
    img.fill(Qt::color1);

    img.setDotsPerMeterX(img.dotsPerMeterX() * 2);
    img.setDotsPerMeterY(img.dotsPerMeterY() * 10);
    
    QPainter *pr = new QPainter;
    QRect r(10,10,80,80);
    pr->begin(&img);
    pr->drawRect(r);
    pr->drawLine(10,10,90,90);
    
    pr->end();
    
    ui->LabelShowImage->setPixmap(QPixmap::fromImage(img));
    
    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