mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Use QWidget::setScreen with Qt 6
This commit is contained in:
parent
490ec7949f
commit
5180e0ec57
3 changed files with 13 additions and 1 deletions
|
@ -585,7 +585,6 @@ void ChooseSourceProcess::setupSourcesGeometry() {
|
||||||
|
|
||||||
void ChooseSourceProcess::setupGeometryWithParent(
|
void ChooseSourceProcess::setupGeometryWithParent(
|
||||||
not_null<QWidget*> parent) {
|
not_null<QWidget*> parent) {
|
||||||
_window->createWinId();
|
|
||||||
const auto parentScreen = [&] {
|
const auto parentScreen = [&] {
|
||||||
if (const auto screen = QGuiApplication::screenAt(
|
if (const auto screen = QGuiApplication::screenAt(
|
||||||
parent->geometry().center())) {
|
parent->geometry().center())) {
|
||||||
|
@ -595,7 +594,12 @@ void ChooseSourceProcess::setupGeometryWithParent(
|
||||||
}();
|
}();
|
||||||
const auto myScreen = _window->screen();
|
const auto myScreen = _window->screen();
|
||||||
if (parentScreen && myScreen != parentScreen) {
|
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);
|
_window->windowHandle()->setScreen(parentScreen);
|
||||||
|
#endif // Qt < 6.0.0
|
||||||
}
|
}
|
||||||
_window->setFixedSize(_fixedSize);
|
_window->setFixedSize(_fixedSize);
|
||||||
_window->move(
|
_window->move(
|
||||||
|
|
|
@ -804,7 +804,11 @@ void OverlayWidget::moveToScreen(bool inMove) {
|
||||||
DEBUG_LOG(("Viewer Pos: Currently on screen %1, moving to screen %2")
|
DEBUG_LOG(("Viewer Pos: Currently on screen %1, moving to screen %2")
|
||||||
.arg(screenList.indexOf(myScreen))
|
.arg(screenList.indexOf(myScreen))
|
||||||
.arg(screenList.indexOf(activeWindowScreen)));
|
.arg(screenList.indexOf(activeWindowScreen)));
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
_window->setScreen(activeWindowScreen);
|
||||||
|
#else // Qt >= 6.0.0
|
||||||
window()->setScreen(activeWindowScreen);
|
window()->setScreen(activeWindowScreen);
|
||||||
|
#endif // Qt < 6.0.0
|
||||||
DEBUG_LOG(("Viewer Pos: New actual screen: %1")
|
DEBUG_LOG(("Viewer Pos: New actual screen: %1")
|
||||||
.arg(screenList.indexOf(_window->screen())));
|
.arg(screenList.indexOf(_window->screen())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -514,7 +514,11 @@ void PipPanel::setPositionDefault() {
|
||||||
const auto parentScreen = widgetScreen(_parent);
|
const auto parentScreen = widgetScreen(_parent);
|
||||||
const auto myScreen = widget()->screen();
|
const auto myScreen = widget()->screen();
|
||||||
if (parentScreen && myScreen != parentScreen) {
|
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);
|
widget()->windowHandle()->setScreen(parentScreen);
|
||||||
|
#endif // Qt < 6.0.0
|
||||||
}
|
}
|
||||||
auto position = Position();
|
auto position = Position();
|
||||||
position.snapped = RectPart::Top | RectPart::Left;
|
position.snapped = RectPart::Top | RectPart::Left;
|
||||||
|
|
Loading…
Add table
Reference in a new issue