File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -211,6 +211,13 @@ void PTZListModel::add(PTZDevice *ptz)
211211 do_reset ();
212212}
213213
214+ void PTZListModel::removeDevice (const QModelIndex &index)
215+ {
216+ PTZDevice *ptz = getDevice (index);
217+ if (ptz)
218+ delete ptz;
219+ }
220+
214221void PTZListModel::remove (PTZDevice *ptz)
215222{
216223 if (ptz == devices.value (ptz->id )) {
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class PTZListModel : public QAbstractListModel {
5959 QModelIndex indexFromDeviceId (uint32_t device_id);
6060 void renameDevice (QString new_name, QString prev_name);
6161 obs_data_array_t *getConfigs ();
62+ void removeDevice (const QModelIndex &index);
6263 void add (PTZDevice *ptz);
6364 void remove (PTZDevice *ptz);
6465 void delete_all ();
Original file line number Diff line number Diff line change @@ -420,10 +420,7 @@ void PTZSettings::on_addPTZ_clicked()
420420
421421void PTZSettings::on_removePTZ_clicked ()
422422{
423- PTZDevice *ptz = ptzDeviceList.getDevice (ui->deviceList ->currentIndex ());
424- if (!ptz)
425- return ;
426- delete ptz;
423+ ptzDeviceList.removeDevice (ui->deviceList ->currentIndex ());
427424}
428425
429426void PTZSettings::on_applyButton_clicked ()
You can’t perform that action at this time.
0 commit comments