From d3497d80407428a1eaa4904d0c299768f5bb383d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Thu, 30 Jul 2015 00:51:36 +0200 Subject: [PATCH] Clear the UI properly before interface switch --- mainwindow.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index f8aa548..130d20e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -57,8 +57,12 @@ void MainWindow::createDeviceProber(const DeviceProber::DeviceInterfaces iface) { std::shared_ptr prober; - if (m_prober != nullptr) + if (m_prober != nullptr) { + if (m_prober->type == iface) + return; + m_prober->closeAllDevices(); + } switch (iface) { case DeviceProber::DeviceInterfaces::LINUX: @@ -112,6 +116,9 @@ void MainWindow::fillDeviceList() { ui->cbox_devices->clear(); + if (m_prober == nullptr) + return; + for (const DeviceProber::DeviceInfo& dinfo : m_prober->listDevices()) { QString name; if (dinfo.name.length() == 0) @@ -220,8 +227,11 @@ void MainWindow::onInterfaceSelected(const int cboxIdx) return; } + ui->cbox_effectSlots->clear(); + iface = static_cast(rawIface); createDeviceProber(iface); + fillDeviceList(); } void MainWindow::onRefreshDevicesClicked() -- 2.43.5