2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Use QWidget::setScreen with Qt 6

This commit is contained in:
Ilya Fedin
2024-06-21 15:05:27 +04:00
committed by John Preston
parent 490ec7949f
commit 5180e0ec57
3 changed files with 13 additions and 1 deletions

View File

@@ -585,7 +585,6 @@ void ChooseSourceProcess::setupSourcesGeometry() {
void ChooseSourceProcess::setupGeometryWithParent(
not_null<QWidget*> parent) {
_window->createWinId();
const auto parentScreen = [&] {
if (const auto screen = QGuiApplication::screenAt(
parent->geometry().center())) {
@@ -595,7 +594,12 @@ void ChooseSourceProcess::setupGeometryWithParent(
}();
const auto myScreen = _window->screen();
if (parentScreen && myScreen != parentScreen) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
_window->setScreen(parentScreen);
#else // Qt >= 6.0.0
_window->createWinId();
_window->windowHandle()->setScreen(parentScreen);
#endif // Qt < 6.0.0
}
_window->setFixedSize(_fixedSize);
_window->move(

View File

@@ -804,7 +804,11 @@ void OverlayWidget::moveToScreen(bool inMove) {
DEBUG_LOG(("Viewer Pos: Currently on screen %1, moving to screen %2")
.arg(screenList.indexOf(myScreen))
.arg(screenList.indexOf(activeWindowScreen)));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
_window->setScreen(activeWindowScreen);
#else // Qt >= 6.0.0
window()->setScreen(activeWindowScreen);
#endif // Qt < 6.0.0
DEBUG_LOG(("Viewer Pos: New actual screen: %1")
.arg(screenList.indexOf(_window->screen())));
}

View File

@@ -514,7 +514,11 @@ void PipPanel::setPositionDefault() {
const auto parentScreen = widgetScreen(_parent);
const auto myScreen = widget()->screen();
if (parentScreen && myScreen != parentScreen) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
widget()->setScreen(parentScreen);
#else // Qt >= 6.0.0
widget()->windowHandle()->setScreen(parentScreen);
#endif // Qt < 6.0.0
}
auto position = Position();
position.snapped = RectPart::Top | RectPart::Left;