Add Platform::screenNumberFor, removes more asQWidget() usage

This commit is contained in:
Sergio Martins
2022-04-21 21:47:55 +01:00
parent eff3798987
commit 4946cdeed3
10 changed files with 55 additions and 23 deletions

View File

@@ -84,6 +84,16 @@ Window::Ptr Platform_qtwidgets::windowAt(QPoint globalPos) const
return {};
}
int Platform_qtwidgets::screenNumberFor(View *view) const
{
if (auto widget = qobject_cast<QWidget *>(view->asQObject())) {
if (QWindow *qtwindow = widget->window()->windowHandle())
return screenNumberForQWindow(qtwindow);
}
return -1;
}
#ifdef DOCKS_DEVELOPER_MODE
void Platform_qtwidgets::tests_initTests() const