Add Platform::screenSizeFor(window), removes more asQWidget() usage
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "views/ViewWrapper_qtwidgets.h"
|
||||
#include "FrameworkWidgetFactory_qtwidgets.h"
|
||||
|
||||
#include <QScreen>
|
||||
#include <QStyleFactory>
|
||||
#include <QApplication>
|
||||
|
||||
@@ -94,6 +95,17 @@ int Platform_qtwidgets::screenNumberFor(View *view) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
QSize Platform_qtwidgets::screenSizeFor(View *view) const
|
||||
{
|
||||
if (auto widget = qobject_cast<QWidget *>(view->asQObject())) {
|
||||
if (QScreen *screen = widget->screen()) {
|
||||
return screen->size();
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
#ifdef DOCKS_DEVELOPER_MODE
|
||||
|
||||
void Platform_qtwidgets::tests_initTests() const
|
||||
|
||||
Reference in New Issue
Block a user