summaryrefslogtreecommitdiffstats
path: root/src/client/vnc/vncwindow.cpp
diff options
context:
space:
mode:
authorManuel Schneider2014-04-25 13:07:50 +0200
committerManuel Schneider2014-04-25 13:07:50 +0200
commit2b2681187163fd487a6033e10b0f8e002d698318 (patch)
tree8cc1da9e2a2640c6217b1cb2293dbeac77d6d8e1 /src/client/vnc/vncwindow.cpp
parentReduced button block code. Moved some magic number to header. (diff)
downloadpvs2-2b2681187163fd487a6033e10b0f8e002d698318.tar.gz
pvs2-2b2681187163fd487a6033e10b0f8e002d698318.tar.xz
pvs2-2b2681187163fd487a6033e10b0f8e002d698318.zip
Now using qWidget instead of qDialog to avoid the need to handdle every dialog
event (reject, done, accept, finished). No more close override necessary.
Diffstat (limited to 'src/client/vnc/vncwindow.cpp')
-rw-r--r--src/client/vnc/vncwindow.cpp28
1 files changed, 5 insertions, 23 deletions
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.
*