summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2014-12-04 12:56:13 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2014-12-04 11:37:59 +0100
commit5d58e6950f63e000d31124b567f2f8351c8820f6 (patch)
treeaf59c662b8bcaad174cb81cdc639ada61a6b01ac /examples
parent52e0a7c73dc5ac3352e4cec8ac7c9295b94eef97 (diff)
downloadqtserialport-5d58e6950f63e000d31124b567f2f8351c8820f6.tar.gz
Do not close closed device in Terminal example
When opening is fails, the QSP himself close a device. Thus, we do not need to close device in Terminal example again, because it caused emmiting of the QSP::NotOpenError and to showing of additional messagebox. Change-Id: Id8aa3f3b835fd7d4187bdf83c1d6584d5fd541f7 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/serialport/terminal/mainwindow.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/serialport/terminal/mainwindow.cpp b/examples/serialport/terminal/mainwindow.cpp
index f9967cc..2cb52a1 100644
--- a/examples/serialport/terminal/mainwindow.cpp
+++ b/examples/serialport/terminal/mainwindow.cpp
@@ -109,7 +109,8 @@ void MainWindow::openSerialPort()
//! [5]
void MainWindow::closeSerialPort()
{
- serial->close();
+ if (serial->isOpen())
+ serial->close();
console->setEnabled(false);
ui->actionConnect->setEnabled(true);
ui->actionDisconnect->setEnabled(false);