mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
fix: The window unable to resize as minimum
This commit is contained in:
parent
abe91bcaac
commit
4a9e250930
@ -74,8 +74,8 @@ MainFrame::MainFrame()
|
||||
setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowSystemMenuHint);
|
||||
#endif
|
||||
|
||||
setMinimumHeight(minHeight);
|
||||
setMinimumWidth(minWidth);
|
||||
setMinimumWidth(MainWindow::Min_Width);
|
||||
setMinimumHeight(MainWindow::Min_Height);
|
||||
|
||||
// Set the window icon
|
||||
QIcon icon;
|
||||
|
@ -49,9 +49,6 @@ class DSDialog;
|
||||
class MainFrame : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static const int minWidth = 800;
|
||||
static const int minHeight = 520;
|
||||
|
||||
public:
|
||||
static const int Margin = 5;
|
||||
|
@ -107,6 +107,7 @@ namespace pv
|
||||
: QMainWindow(parent)
|
||||
{
|
||||
_msg = NULL;
|
||||
_frame = parent;
|
||||
|
||||
_session = AppControl::Instance()->GetSession();
|
||||
_session->set_callback(this);
|
||||
@ -1765,6 +1766,7 @@ namespace pv
|
||||
}
|
||||
}
|
||||
}
|
||||
calc_min_height();
|
||||
break;
|
||||
|
||||
case DSV_MSG_DEVICE_OPTIONS_UPDATED:
|
||||
@ -1813,6 +1815,8 @@ namespace pv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
calc_min_height();
|
||||
break;
|
||||
|
||||
case DSV_MSG_NEW_USB_DEVICE:
|
||||
@ -1923,7 +1927,9 @@ namespace pv
|
||||
}
|
||||
}
|
||||
}
|
||||
calc_min_height();
|
||||
break;
|
||||
|
||||
case DSV_MSG_BEGIN_DEVICE_OPTIONS:
|
||||
if(_device_agent->is_demo())
|
||||
{
|
||||
@ -1937,4 +1943,24 @@ namespace pv
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::calc_min_height()
|
||||
{
|
||||
if (_frame != NULL)
|
||||
{
|
||||
if (_device_agent->get_work_mode() == LOGIC)
|
||||
{
|
||||
int ch_num = _session->get_ch_num(-1);
|
||||
int win_height = Base_Height + Per_Chan_Height * ch_num;
|
||||
|
||||
if (win_height < Min_Height)
|
||||
_frame->setMinimumHeight(win_height);
|
||||
else
|
||||
_frame->setMinimumHeight(Min_Height);
|
||||
}
|
||||
else{
|
||||
_frame->setMinimumHeight(Min_Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pv
|
||||
|
@ -81,6 +81,12 @@ class MainWindow :
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const int Min_Width = 800;
|
||||
static const int Min_Height = 520;
|
||||
static const int Base_Height = 150;
|
||||
static const int Per_Chan_Height = 35;
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
|
||||
@ -139,6 +145,7 @@ private:
|
||||
void load_device_config();
|
||||
QJsonDocument get_session_json_from_file(QString file);
|
||||
QJsonArray get_decoder_json_from_file(QString file);
|
||||
void calc_min_height();
|
||||
|
||||
private:
|
||||
//ISessionCallback
|
||||
@ -215,6 +222,7 @@ private:
|
||||
high_resolution_clock::time_point _last_key_press_time;
|
||||
bool _is_save_confirm_msg;
|
||||
std::string _pattern_mode;
|
||||
QWidget *_frame;
|
||||
|
||||
int _key_value;
|
||||
bool _key_vaild;
|
||||
|
Loading…
x
Reference in New Issue
Block a user