Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.6.0
-
None
-
Windows 7, Qt 5.6.0 MinGW
-
ccfe33dc670a1491d9e1daa2ae17f5fe30484276 (qtbase/5.6, 22.4.2016, 5.6.1)
Description
When enabled HighDPI support QWidget->grab function works wrong.
Example:
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QPushButton *btn = new QPushButton("TEST"); connect(btn, &QPushButton::clicked, [=](bool checked ) { qDebug() << "Button size: " << btn->size(); QPixmap defPix = btn->grab(); qDebug() << "Default grab. Pixmap size: " << defPix.size(); defPix.save("defpix.png"); QPixmap dprPix = btn->grab(QRect(0,0, btn->width() * btn->devicePixelRatio(), btn->height() * btn->devicePixelRatio())); qDebug() << "Grab using dpr. Pixmap size: " << dprPix.size(); dprPix.save("dprpix.png"); }); ui->verticalLayout->addWidget(btn); }
Program outputs:
Button size: QSize(378, 17) Default grab. Pixmap size: QSize(378, 17) Grab using dpr. Pixmap size: QSize(756, 34)
Real button size on screen is 756x34. But if use "Grab using dpr" we get wrong pixmap. See attachments.
Attachments
Issue Links
- resulted in
-
QTBUG-53713 [REG Qt 5.6.0 -> Qt 5.6.1] Designer: Wrong display of object when dragging when High DPI scaling is active
- Closed