1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:59:56 +00:00

Migrate Grow Limit editor feature to a more modern code

This commit is contained in:
Andrei Kortunov 2023-02-07 20:09:59 +04:00
parent 6f4624e9fe
commit 9ad0e2f4e6

View file

@ -2,11 +2,6 @@
#include <QApplication> #include <QApplication>
#include <QCloseEvent> #include <QCloseEvent>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QDesktopWidget>
#endif
#include <QMenuBar> #include <QMenuBar>
#include <QMessageBox> #include <QMessageBox>
#include <QScreen> #include <QScreen>
@ -51,6 +46,16 @@
#include "subviewfactoryimp.hpp" #include "subviewfactoryimp.hpp"
#include "viewmanager.hpp" #include "viewmanager.hpp"
QRect desktopRect()
{
QRegion virtualGeometry;
for (auto screen : QGuiApplication::screens())
{
virtualGeometry += screen->geometry();
}
return virtualGeometry.boundingRect();
}
void CSVDoc::View::closeEvent(QCloseEvent* event) void CSVDoc::View::closeEvent(QCloseEvent* event)
{ {
if (!mViewManager.closeRequest(this)) if (!mViewManager.closeRequest(this))
@ -1106,15 +1111,11 @@ void CSVDoc::View::merge()
void CSVDoc::View::updateWidth(bool isGrowLimit, int minSubViewWidth) void CSVDoc::View::updateWidth(bool isGrowLimit, int minSubViewWidth)
{ {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QRect rect; QRect rect;
if (isGrowLimit) if (isGrowLimit)
rect = QApplication::screenAt(pos())->geometry(); rect = QApplication::screenAt(pos())->geometry();
else else
rect = QGuiApplication::screens().at(QApplication::desktop()->screenNumber(this))->geometry(); rect = desktopRect();
#else
QRect rect = QApplication::screenAt(pos())->geometry();
#endif
if (!mScrollbarOnly && mScroll && mSubViews.size() > 1) if (!mScrollbarOnly && mScroll && mSubViews.size() > 1)
{ {