From 2b2681187163fd487a6033e10b0f8e002d698318 Mon Sep 17 00:00:00 2001 From: Manuel Schneider Date: Fri, 25 Apr 2014 13:07:50 +0200 Subject: Now using qWidget instead of qDialog to avoid the need to handdle every dialog event (reject, done, accept, finished). No more close override necessary. --- src/client/vnc/vncwindow.cpp | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) (limited to 'src/client/vnc/vncwindow.cpp') diff --git a/src/client/vnc/vncwindow.cpp b/src/client/vnc/vncwindow.cpp index 581d503..13ad107 100644 --- a/src/client/vnc/vncwindow.cpp +++ b/src/client/vnc/vncwindow.cpp @@ -19,7 +19,7 @@ #include "vncthread.h" VncWindow::VncWindow(QWidget *parent) : - QDialog(parent), _vncWorker(NULL), _viewOnly(true), _clientId(0), _redrawTimer(0), _tcpTimeoutTimer(0) + QWidget(parent), _vncWorker(NULL), _viewOnly(true), _clientId(0), _redrawTimer(0), _tcpTimeoutTimer(0) { // } @@ -130,16 +130,16 @@ void VncWindow::open(const QString& host, int port, const QString& passwd, bool /** * Called by Qt if the window is requested to be closed. This can either happen - * through code (this->close()), or a keypress (Alt-F4, Esc). We'll ignore the - * request and simply hide the window. + * through code (this->close()), or a keypress (Alt-F4). As long as + * Qt::WA_DeleteOnClose is not set the QWidget gets just hidden and not quit. + * See http://qt-project.org/doc/qt-4.8/qcloseevent.html#details for more + * details. * * @param e close event data */ void VncWindow::closeEvent(QCloseEvent *e) { - e->ignore(); qDebug("Closing VNC viewer window."); - this->setVisible(false); this->terminateVncThread(); emit running(false, _clientId); } @@ -188,24 +188,6 @@ void VncWindow::onProjectionStopped() //////////////////////////////////////////////////////////////////////////////// // Protected - -/** - * Request to close the window. Overriden from QDialog/QWidget. - * If the window is already hidden, this just emits a signal that - * will tell the server that we're not watching a VNC stream - * currently. Otherwise it will just call the implementation of - * the super class. - * - * @return false - */ -bool VncWindow::close() -{ - if (this->isVisible()) - return QDialog::close(); - emit running(false, _clientId); - return false; -} - /** * Called when a Qt timer fires. * -- cgit v1.2.3-55-g7522