mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-20 15:40:32 +00:00
Merge branch 'editor-crash' into 'master'
Clamp widgets coordinates to avoid editor crashes See merge request OpenMW/openmw!4043
This commit is contained in:
commit
9662586947
@ -1110,7 +1110,16 @@ void CSVDoc::View::updateWidth(bool isGrowLimit, int minSubViewWidth)
|
||||
{
|
||||
QRect rect;
|
||||
if (isGrowLimit)
|
||||
rect = QApplication::screenAt(pos())->geometry();
|
||||
{
|
||||
// Widget position can be negative, we should clamp it.
|
||||
QPoint position = pos();
|
||||
if (position.x() <= 0)
|
||||
position.setX(0);
|
||||
if (position.y() <= 0)
|
||||
position.setY(0);
|
||||
|
||||
rect = QApplication::screenAt(position)->geometry();
|
||||
}
|
||||
else
|
||||
rect = desktopRect();
|
||||
|
||||
|
@ -78,8 +78,16 @@ CSVWorld::TableSubView::TableSubView(
|
||||
widget->setLayout(layout);
|
||||
|
||||
setWidget(widget);
|
||||
|
||||
// Widget position can be negative, we should clamp it.
|
||||
QPoint position = pos();
|
||||
if (position.x() <= 0)
|
||||
position.setX(0);
|
||||
if (position.y() <= 0)
|
||||
position.setY(0);
|
||||
|
||||
// prefer height of the screen and full width of the table
|
||||
const QRect rect = QApplication::screenAt(pos())->geometry();
|
||||
const QRect rect = QApplication::screenAt(position)->geometry();
|
||||
int frameHeight = 40; // set a reasonable default
|
||||
QWidget* topLevel = QApplication::topLevelAt(pos());
|
||||
if (topLevel)
|
||||
|
Loading…
x
Reference in New Issue
Block a user