Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. 关于QImage类中setDotsPerMeterX()的使用
Forum Updated to NodeBB v4.3 + New Features

关于QImage类中setDotsPerMeterX()的使用

Scheduled Pinned Locked Moved Unsolved Chinese
1 Posts 1 Posters 844 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

    我创建了一幅图片, 想要用setDotsPerMeterX()调整图片的DPI, 但是最后显示出来的图片没有任何变化。
    下面是一个测试代码:
    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)); // Show original image.
    
    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