mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
fix: trigger pannel resize to max, DSView crashed
This commit is contained in:
parent
5af4cb89b8
commit
8ad70251e6
@ -42,8 +42,8 @@
|
|||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QDesktopWidget>
|
#include <QGuiApplication>
|
||||||
|
|
||||||
#include "dsvdef.h"
|
#include "dsvdef.h"
|
||||||
#include "config/appconfig.h"
|
#include "config/appconfig.h"
|
||||||
@ -421,19 +421,21 @@ void MainFrame::readSettings()
|
|||||||
int right = app._frameOptions.right;
|
int right = app._frameOptions.right;
|
||||||
int bottom = app._frameOptions.bottom;
|
int bottom = app._frameOptions.bottom;
|
||||||
|
|
||||||
QRect scRect = QApplication::desktop()->screenGeometry();
|
int screen_width = QGuiApplication::primaryScreen()->availableGeometry().width();
|
||||||
|
int screen_height = QGuiApplication::primaryScreen()->availableGeometry().height();
|
||||||
|
|
||||||
bool bReset = false;
|
bool bReset = false;
|
||||||
|
|
||||||
if (right == 0)
|
if (right == 0)
|
||||||
{
|
{
|
||||||
bReset = true;
|
bReset = true;
|
||||||
}
|
}
|
||||||
if (right - left >= scRect.width())
|
if (right - left >= screen_width)
|
||||||
{
|
{
|
||||||
bReset = true;
|
bReset = true;
|
||||||
}
|
}
|
||||||
int sp = 70;
|
int sp = 70;
|
||||||
if (right < sp || bottom < sp || left + sp >= scRect.width() || top + sp >= scRect.height()){
|
if (right < sp || bottom < sp || left + sp >= screen_width || top + sp >= screen_height){
|
||||||
bReset = true;
|
bReset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,12 +444,10 @@ void MainFrame::readSettings()
|
|||||||
showMaximized(); // show max by system api
|
showMaximized(); // show max by system api
|
||||||
}
|
}
|
||||||
else if (bReset)
|
else if (bReset)
|
||||||
{
|
{
|
||||||
QScreen *screen = QGuiApplication::primaryScreen();
|
resize(screen_width / 2, screen_height / 1.5);
|
||||||
const QRect availableGeometry = screen->availableGeometry();
|
const int origX = std::max(0, (screen_width - width()) / 2);
|
||||||
resize(availableGeometry.width() / 2, availableGeometry.height() / 1.5);
|
const int origY = std::max(0, (screen_height - height()) / 2);
|
||||||
const int origX = std::max(0, (availableGeometry.width() - width()) / 2);
|
|
||||||
const int origY = std::max(0, (availableGeometry.height() - height()) / 2);
|
|
||||||
move(origX, origY);
|
move(origX, origY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -826,12 +826,13 @@ void DsoSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor
|
|||||||
(void)fore;
|
(void)fore;
|
||||||
(void)back;
|
(void)back;
|
||||||
|
|
||||||
if (!_show)
|
if (!_show || right >= left){
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
assert(_data);
|
assert(_data);
|
||||||
assert(_view);
|
assert(_view);
|
||||||
assert(right >= left);
|
//assert(right >= left);
|
||||||
|
|
||||||
if (enabled()) {
|
if (enabled()) {
|
||||||
const int index = get_index();
|
const int index = get_index();
|
||||||
|
@ -113,8 +113,7 @@ DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack,
|
|||||||
|
|
||||||
_widget->setLayout(_layout);
|
_widget->setLayout(_layout);
|
||||||
parent->layout()->addWidget(_widget);
|
parent->layout()->addWidget(_widget);
|
||||||
// setWidget(_widget);
|
|
||||||
// _widget->installEventFilter(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DecoderGroupBox::~DecoderGroupBox()
|
DecoderGroupBox::~DecoderGroupBox()
|
||||||
@ -122,16 +121,7 @@ DecoderGroupBox::~DecoderGroupBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DecoderGroupBox::eventFilter(QObject *o, QEvent *e)
|
bool DecoderGroupBox::eventFilter(QObject *o, QEvent *e)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if(o == _widget && e->type() == QEvent::Resize) {
|
|
||||||
setMinimumWidth(_widget->minimumSizeHint().width() + verticalScrollBar()->width());
|
|
||||||
QScreen *screen=QGuiApplication::primaryScreen ();
|
|
||||||
QRect mm=screen->availableGeometry() ;
|
|
||||||
if (_widget->minimumSizeHint().height() < mm.height()/2)
|
|
||||||
setMinimumHeight(_widget->minimumSizeHint().height());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user