98int QPaintDeviceWindow::metric(PaintDeviceMetric metric)
const
100 QScreen *screen =
this->screen();
101 if (!screen && QGuiApplication::primaryScreen())
102 screen = QGuiApplication::primaryScreen();
109 return width() * screen->physicalSize().width() / screen->geometry().width();
115 return height() * screen->physicalSize().height() / screen->geometry().height();
119 return qRound(screen->logicalDotsPerInchX());
123 return qRound(screen->logicalDotsPerInchY());
125 case PdmPhysicalDpiX:
127 return qRound(screen->physicalDotsPerInchX());
129 case PdmPhysicalDpiY:
131 return qRound(screen->physicalDotsPerInchY());
133 case PdmDevicePixelRatio:
134 return int(QWindow::devicePixelRatio());
136 case PdmDevicePixelRatioScaled:
137 return int(QWindow::devicePixelRatio() * devicePixelRatioFScale());
139 case PdmDevicePixelRatioF_EncodedA:
141 case PdmDevicePixelRatioF_EncodedB:
142 return QPaintDevice::encodeMetricF(metric, QWindow::devicePixelRatio());
148 return QPaintDevice::metric(metric);
162bool QPaintDeviceWindow::event(QEvent *event)
164 Q_D(QPaintDeviceWindow);
166 if (event->type() == QEvent::UpdateRequest) {
168 d->handleUpdateEvent();
170 }
else if (event->type() == QEvent::Paint) {
171 d->markWindowAsDirty();
176 auto region = QRect(QPoint(0, 0), size());
179 }
else if (event->type() == QEvent::Resize) {
180 d->handleResizeEvent();
183 return QWindow::event(event);