54QWindow *QPlatformScreen::topLevelAt(
const QPoint & pos)
const
56 const QWindowList list = QGuiApplication::topLevelWindows();
57 const auto crend = list.crend();
58 for (
auto it = list.crbegin(); it != crend; ++it) {
60 if (w->isVisible() && QHighDpi::toNativePixels(w->geometry(), w).contains(pos))
86const QPlatformScreen *QPlatformScreen::screenForPosition(
const QPoint &point)
const
88 if (!geometry().contains(point)) {
89 const auto screens = virtualSiblings();
90 for (
const QPlatformScreen *screen : screens) {
91 if (screen->geometry().contains(point))
318void QPlatformScreen::resizeMaximizedWindows()
322 const QRect oldGeometry = screen()->geometry();
323 const QRect oldAvailableGeometry = screen()->availableGeometry();
324 const QRect newNativeGeometry =
this->geometry();
325 const QRect newNativeAvailableGeometry =
this->availableGeometry();
327 const bool supportsMaximizeUsingFullscreen = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::MaximizeUsingFullscreenGeometry);
329 for (QWindow *w : windows()) {
339 if (supportsMaximizeUsingFullscreen
340 && w->windowState() & Qt::WindowMaximized
341 && w->flags() & Qt::ExpandedClientAreaHint) {
342 w->handle()->setGeometry(newNativeGeometry);
343 }
else if (w->windowState() & Qt::WindowMaximized || w->geometry() == oldAvailableGeometry) {
344 w->handle()->setGeometry(newNativeAvailableGeometry);
345 }
else if (w->windowState() & Qt::WindowFullScreen || w->geometry() == oldGeometry) {
346 w->handle()->setGeometry(newNativeGeometry);
365int QPlatformScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
367 if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
368 qWarning(
"Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation",
"angle");
375 int ia = log2(uint(a));
376 int ib = log2(uint(b));
383 int angles[] = { 0, 90, 180, 270 };
384 return angles[delta];
387QTransform QPlatformScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b,
const QRect &target)
389 if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
390 qWarning(
"Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation",
"transform");
397 int angle = angleBetween(a, b);
402 result.translate(target.width(), 0);
405 result.translate(target.width(), target.height());
408 result.translate(0, target.height());
413 result.rotate(angle);
418QRect QPlatformScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b,
const QRect &rect)
420 if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) {
421 qWarning(
"Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation",
"map");
428 if ((a == Qt::PortraitOrientation || a == Qt::InvertedPortraitOrientation)
429 != (b == Qt::PortraitOrientation || b == Qt::InvertedPortraitOrientation))
431 return QRect(rect.y(), rect.x(), rect.height(), rect.width());
444QPlatformScreen::SubpixelAntialiasingType QPlatformScreen::subpixelAntialiasingTypeHint()
const
446 static int type = -1;
448 QByteArray env = qgetenv(
"QT_SUBPIXEL_AA_TYPE");
450 type = QPlatformScreen::Subpixel_RGB;
451 else if (env ==
"BGR")
452 type = QPlatformScreen::Subpixel_BGR;
453 else if (env ==
"VRGB")
454 type = QPlatformScreen::Subpixel_VRGB;
455 else if (env ==
"VBGR")
456 type = QPlatformScreen::Subpixel_VBGR;
458 type = QPlatformScreen::Subpixel_None;
461 return static_cast<QPlatformScreen::SubpixelAntialiasingType>(type);
531QList<QPlatformScreen *> QPlatformPlaceholderScreen::virtualSiblings()
const
533 QList<QPlatformScreen *> siblings;
535 if (!m_virtualSibling)
538 for (QScreen *screen : QGuiApplication::screens()) {
539 if (screen->handle() && screen->handle() !=
this)
540 siblings << screen->handle();