@@ -39,6 +39,8 @@ PageMultiInfo::PageMultiInfo(QWidget *parent)
3939 , mp_Table(new PageTableHeader(this ))
4040 , mp_Detail(new PageDetail(this ))
4141{
42+ m_deviceList.clear ();
43+ m_menuControlList.clear ();
4244 // 初始化界面布局
4345 initWidgets ();
4446
@@ -67,6 +69,8 @@ PageMultiInfo::~PageMultiInfo()
6769 delete mp_Detail;
6870 mp_Detail = nullptr ;
6971 }
72+ m_deviceList.clear ();
73+ m_menuControlList.clear ();
7074}
7175
7276void PageMultiInfo::updateInfo (const QList<DeviceBaseInfo *> &lst)
@@ -76,14 +80,14 @@ void PageMultiInfo::updateInfo(const QList<DeviceBaseInfo *> &lst)
7680
7781 if (lst.size () < 1 )
7882 return ;
83+ m_deviceList.clear ();
84+ m_menuControlList.clear ();
7985
8086 // 获取多个设备界面表格信息
81- QList<QStringList> deviceList;
82- QList<QStringList> menuControlList;
83- getTableListInfo (lst, deviceList, menuControlList);
87+ getTableListInfo (lst, m_deviceList, m_menuControlList);
8488
8589 // 更新表格
86- mp_Table->updateTable (deviceList, menuControlList );
90+ mp_Table->updateTable (m_deviceList, m_menuControlList );
8791
8892 // 更新详细信息
8993 mp_Detail->showDeviceInfo (lst);
@@ -116,15 +120,12 @@ void PageMultiInfo::resizeEvent(QResizeEvent *e)
116120
117121 // 先获取当前窗口大小
118122 int curHeight = this ->height ();
119- QList<QStringList> deviceList;
120- QList<QStringList> menuControlList;
121- getTableListInfo (m_lstDevice, deviceList, menuControlList);
122123 if (curHeight < LEAST_PAGE_HEIGHT) {
123124 // 获取多个设备界面表格信息
124- mp_Table->updateTable (deviceList, menuControlList , true , (LEAST_PAGE_HEIGHT - curHeight) / TREE_ROW_HEIGHT + 1 );
125+ mp_Table->updateTable (m_deviceList, m_menuControlList , true , (LEAST_PAGE_HEIGHT - curHeight) / TREE_ROW_HEIGHT + 1 );
125126 } else {
126127 // 获取多个设备界面表格信息
127- mp_Table->updateTable (deviceList, menuControlList , true , 0 );
128+ mp_Table->updateTable (m_deviceList, m_menuControlList , true , 0 );
128129 }
129130
130131 return PageInfo::resizeEvent (e);
@@ -245,8 +246,10 @@ void PageMultiInfo::initWidgets()
245246void PageMultiInfo::getTableListInfo (const QList<DeviceBaseInfo *> &lst, QList<QStringList> &deviceList, QList<QStringList> &menuControlList)
246247{
247248 // 获取多个设备界面表格信息
249+ if (lst[0 ] == nullptr ) return ;
248250 deviceList.append (lst[0 ]->getTableHeader ());
249251 foreach (DeviceBaseInfo *info, lst) {
252+ if (info == nullptr ) continue ;
250253 QStringList lstDeviceInfo = info->getTableData ();
251254 deviceList.append (lstDeviceInfo);
252255
0 commit comments