55QWindow *QPlatformScreen::topLevelAt(
const QPoint & pos)
const
57 const QWindowList list = QGuiApplication::topLevelWindows();
58 const auto crend = list.crend();
59 for (
auto it = list.crbegin(); it != crend; ++it) {
61 if (w->isVisible() && QHighDpi::toNativePixels(w->geometry(), w).contains(pos))
87const QPlatformScreen *QPlatformScreen::screenForPosition(
const QPoint &point)
const
89 if (!geometry().contains(point)) {
90 const auto screens = virtualSiblings();
91 for (
const QPlatformScreen *screen : screens) {
92 if (screen->geometry().contains(point))
319void QPlatformScreen::resizeMaximizedWindows()
323 const QRect oldGeometry = screen()->geometry();
324 const QRect oldAvailableGeometry = screen()->availableGeometry();
325 const QRect newNativeGeometry =
this->geometry();
326 const QRect newNativeAvailableGeometry =
this->availableGeometry();
328 const bool supportsMaximizeUsingFullscreen = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MaximizeUsingFullscreenGeometry);
330 for (QWindow *w : windows()) {
340 if (supportsMaximizeUsingFullscreen
341 && w->windowState() & Qt::WindowMaximized
342 && w->flags() & Qt::ExpandedClientAreaHint) {
343 w->handle()->setGeometry(newNativeGeometry);
344 }
else if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry) {
345 w->handle()->setGeometry(newNativeAvailableGeometry);
346 }
else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry) {
347 w->handle()->setGeometry(newNativeGeometry);
366int QPlatformScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
368 if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
369 qWarning(
"Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation",
"angle");
376 int ia = log2(uint(a));
377 int ib = log2(uint(b));
384 int angles[] = { 0, 90, 180, 270 };
385 return angles[delta];
388QTransform QPlatformScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b,
const QRect &target)
390 if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
391 qWarning(
"Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation",
"transform");
398 int angle = angleBetween(a, b);
403 result.translate(target.width(), 0);
406 result.translate(target.width(), target.height());
409 result.translate(0, target.height());
414 result.rotate(angle);
419QRect QPlatformScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b,
const QRect &rect)
421 if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
422 qWarning(
"Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation",
"map");
429 if ((a == Qt::PortraitOrientation || a == Qt::InvertedPortraitOrientation)
430 != (b == Qt::PortraitOrientation || b == Qt::InvertedPortraitOrientation))
432 return QRect(rect.y(), rect.x(), rect.height(), rect.width());
445QPlatformScreen::SubpixelAntialiasingType QPlatformScreen::subpixelAntialiasingTypeHint()
const
447 static int type = -1;
449 QByteArray env = qgetenv(
"QT_SUBPIXEL_AA_TYPE");
451 type = QPlatformScreen::Subpixel_RGB;
452 else if (env ==
"BGR")
453 type = QPlatformScreen::Subpixel_BGR;
454 else if (env ==
"VRGB")
455 type = QPlatformScreen::Subpixel_VRGB;
456 else if (env ==
"VBGR")
457 type = QPlatformScreen::Subpixel_VBGR;
459 type = QPlatformScreen::Subpixel_None;
462 return static_cast<QPlatformScreen::SubpixelAntialiasingType>(type);
532QList<QPlatformScreen *> QPlatformPlaceholderScreen::virtualSiblings()
const
534 QList<QPlatformScreen *> siblings;
536 if (!m_virtualSibling)
539 for (QScreen *screen : QGuiApplication::screens()) {
540 if (screen->handle() && screen->handle() !=
this)
541 siblings << screen->handle();