diff options
author | Laszlo Papp <lpapp@kde.org> | 2012-04-08 14:48:42 +0300 |
---|---|---|
committer | Denis Shienkov <scapig@yandex.ru> | 2012-04-08 20:39:21 +0200 |
commit | e4d63027e9ea706e21d347ada9e16dcd51a58e21 (patch) | |
tree | 45b36a5942345d4d9d2ea4c09bb29781639f30f4 /examples | |
parent | bf63a2e0ae72af4ce08eb236e6f55a6716d06d74 (diff) | |
download | qtserialport-e4d63027e9ea706e21d347ada9e16dcd51a58e21.tar.gz |
Use open/closeSerialPort terms instead of simply open/close
The reason behind is that, the close() method is already an existing one for the
QMainWindow. See the documentation here for further details:
http://qt-project.org/doc/qt-4.8/qwidget.html#close
I would like to use that method with a "Quit" action for closing the application
in the near future. See my next patch about the details of that feature.
Hence, renaming is a reasonable step in my opinion requiring minor effort. I
thought, if I am at renaming the implemented "close()" method to
"closeSerialPort()", I could just well rename the implemented "open()" method to
"openSerialPort()" as well for the sake of consistency even if there is no
"open" method for the QMainWindow class.
The relevant connect lines are also being modified obviously. I have tested the
connect and disconnect actions after this minor modification, and they work just
fine with my modem connected to the serial port via an usb-serial converter
(PL2303).
Change-Id: Ib5ee315e244cc5fa77210725b3548217ac12ca27
Reviewed-by: Denis Shienkov <scapig@yandex.ru>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/terminal/mainwindow.cpp | 8 | ||||
-rw-r--r-- | examples/terminal/mainwindow.h | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/terminal/mainwindow.cpp b/examples/terminal/mainwindow.cpp index 27e60a1..0a7e643 100644 --- a/examples/terminal/mainwindow.cpp +++ b/examples/terminal/mainwindow.cpp @@ -34,7 +34,7 @@ MainWindow::~MainWindow() delete ui; } -void MainWindow::open() +void MainWindow::openSerialPort() { SettingsDialog::Settings p = settings->settings(); serial->setPort(p.name); @@ -72,7 +72,7 @@ void MainWindow::open() } } -void MainWindow::close() +void MainWindow::closeSerialPort() { serial->close(); console->setEnabled(false); @@ -103,8 +103,8 @@ void MainWindow::readData() void MainWindow::initActionsConnections() { - connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(open())); - connect(ui->actionDisconnect, SIGNAL(triggered()), this, SLOT(close())); + connect(ui->actionConnect, SIGNAL(triggered()), this, SLOT(openSerialPort())); + connect(ui->actionDisconnect, SIGNAL(triggered()), this, SLOT(closeSerialPort())); connect(ui->actionConfigure, SIGNAL(triggered()), settings, SLOT(show())); connect(ui->actionClear, SIGNAL(triggered()), console, SLOT(clear())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); diff --git a/examples/terminal/mainwindow.h b/examples/terminal/mainwindow.h index 15f0779..57a88c1 100644 --- a/examples/terminal/mainwindow.h +++ b/examples/terminal/mainwindow.h @@ -29,8 +29,8 @@ public: ~MainWindow(); private slots: - void open(); - void close(); + void openSerialPort(); + void closeSerialPort(); void about(); void writeData(const QByteArray &data); void readData(); |