99int QPaintDeviceWindow::metric(PaintDeviceMetric metric)
const
101 QScreen *screen =
this->screen();
102 if (!screen && QGuiApplication::primaryScreen())
103 screen = QGuiApplication::primaryScreen();
110 return width() * screen->physicalSize().width() / screen->geometry().width();
116 return height() * screen->physicalSize().height() / screen->geometry().height();
120 return qRound(screen->logicalDotsPerInchX());
124 return qRound(screen->logicalDotsPerInchY());
126 case PdmPhysicalDpiX:
128 return qRound(screen->physicalDotsPerInchX());
130 case PdmPhysicalDpiY:
132 return qRound(screen->physicalDotsPerInchY());
134 case PdmDevicePixelRatio:
135 return int(QWindow::devicePixelRatio());
137 case PdmDevicePixelRatioScaled:
138 return int(QWindow::devicePixelRatio() * devicePixelRatioFScale());
140 case PdmDevicePixelRatioF_EncodedA:
142 case PdmDevicePixelRatioF_EncodedB:
143 return QPaintDevice::encodeMetricF(metric, QWindow::devicePixelRatio());
149 return QPaintDevice::metric(metric);
163bool QPaintDeviceWindow::event(QEvent *event)
165 Q_D(QPaintDeviceWindow);
167 if (event->type() == QEvent::UpdateRequest) {
169 d->handleUpdateEvent();
171 }
else if (event->type() == QEvent::Paint) {
172 d->markWindowAsDirty();
177 auto region = QRect(QPoint(0, 0), size());
180 }
else if (event->type() == QEvent::Resize) {
181 d->handleResizeEvent();
184 return QWindow::event(event);