summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-04-11 15:03:54 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-04-11 15:05:09 (GMT)
commit73f845a3f380c5a1adbac2cf29e9f36cc9b498cf (patch)
tree25655c928aa2d4a8c05e54f9c7c18203286fb8f3 /Swift/QtUI/QtWebView.h
parent8b09a21b14488a6ceb159607511b351d5cd60ac2 (diff)
downloadswift-73f845a3f380c5a1adbac2cf29e9f36cc9b498cf.zip
swift-73f845a3f380c5a1adbac2cf29e9f36cc9b498cf.tar.bz2
Proper handling of keypresses in the chat input that're meant for the chat log.
Resolves: #284
Diffstat (limited to 'Swift/QtUI/QtWebView.h')
-rw-r--r--Swift/QtUI/QtWebView.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/Swift/QtUI/QtWebView.h b/Swift/QtUI/QtWebView.h
new file mode 100644
index 0000000..8ed5842
--- /dev/null
+++ b/Swift/QtUI/QtWebView.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+
+#pragma once
+
+#include <QWebView>
+
+namespace Swift {
+ class QtWebView : public QWebView {
+ public:
+ QtWebView(QWidget* parent) : QWebView(parent) {}
+ void keyPressEvent(QKeyEvent* event) {
+ Qt::KeyboardModifiers modifiers = event->modifiers();
+ int key = event->key();
+ if (modifiers == Qt::ShiftModifier && (key == Qt::Key_PageUp || key == Qt::Key_PageDown)) {
+ modifiers = Qt::NoModifier;
+ }
+ QKeyEvent* translatedEvent = new QKeyEvent(QEvent::KeyPress,
+ key,
+ modifiers,
+ event->text(),
+ event->isAutoRepeat(),
+ event->count());
+ QWebView::keyPressEvent(translatedEvent);
+ delete translatedEvent;
+ };
+ };
+}