mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-13 13:32:53 +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 <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFile>
|
||||
#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;
|
||||
}
|
||||
|
||||
@ -442,12 +444,10 @@ void MainFrame::readSettings()
|
||||
showMaximized(); // show max by system api
|
||||
}
|
||||
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
|
||||
|
@ -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();
|
||||
|
@ -113,8 +113,7 @@ DecoderGroupBox::DecoderGroupBox(data::DecoderStack *decoder_stack,
|
||||
|
||||
_widget->setLayout(_layout);
|
||||
parent->layout()->addWidget(_widget);
|
||||
// setWidget(_widget);
|
||||
// _widget->installEventFilter(this);
|
||||
|
||||
}
|
||||
|
||||
DecoderGroupBox::~DecoderGroupBox()
|
||||
@ -122,16 +121,7 @@ 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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user