fix: trigger pannel resize to max, DSView crashed

This commit is contained in:
dreamsourcelabTAI 2022-05-18 09:23:16 +08:00
parent 5af4cb89b8
commit 8ad70251e6
3 changed files with 16 additions and 25 deletions

View File

@ -43,7 +43,7 @@
#include <QApplication>
#include <QDebug>
#include <QFile>
#include <QDesktopWidget>
#include <QGuiApplication>
#include "dsvdef.h"
#include "config/appconfig.h"
@ -421,19 +421,21 @@ void MainFrame::readSettings()
int right = app._frameOptions.right;
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;
if (right == 0)
{
bReset = true;
}
if (right - left >= scRect.width())
if (right - left >= screen_width)
{
bReset = true;
}
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;
}
@ -443,11 +445,9 @@ void MainFrame::readSettings()
}
else if (bReset)
{
QScreen *screen = QGuiApplication::primaryScreen();
const QRect availableGeometry = screen->availableGeometry();
resize(availableGeometry.width() / 2, availableGeometry.height() / 1.5);
const int origX = std::max(0, (availableGeometry.width() - width()) / 2);
const int origY = std::max(0, (availableGeometry.height() - height()) / 2);
resize(screen_width / 2, screen_height / 1.5);
const int origX = std::max(0, (screen_width - width()) / 2);
const int origY = std::max(0, (screen_height - height()) / 2);
move(origX, origY);
}
else

View File

@ -826,12 +826,13 @@ void DsoSignal::paint_mid(QPainter &p, int left, int right, QColor fore, QColor
(void)fore;
(void)back;
if (!_show)
if (!_show || right >= left){
return;
}
assert(_data);
assert(_view);
assert(right >= left);
//assert(right >= left);
if (enabled()) {
const int index = get_index();

View File

@ -113,8 +113,7 @@ DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack,
_widget->setLayout(_layout);
parent->layout()->addWidget(_widget);
// setWidget(_widget);
// _widget->installEventFilter(this);
}
DecoderGroupBox::~DecoderGroupBox()
@ -123,15 +122,6 @@ DecoderGroupBox::~DecoderGroupBox()
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;
}