[kde-doc-english] [trojita] src/Gui: GUI: Prevent QGroupBox from eating the Space key presses

Jan Kundrát jkt at kde.org
Sun Nov 29 18:18:40 UTC 2015


Git commit c6b7d3a3056b23cbd02eb17238d1c3417bc0eece by Jan Kundrát.
Committed on 27/11/2015 at 15:26.
Pushed by gerrit into branch 'master'.

GUI: Prevent QGroupBox from eating the Space key presses

We don't use "checkable group boxes" or however these are called; we
use the space key for scrolling the message's content.

Change-Id: I55e6c806f2b67524b544bbc2ce817ffb61489d45

M  +12   -0    src/Gui/PartWidget.cpp
M  +1    -0    src/Gui/PartWidget.h

http://commits.kde.org/trojita/c6b7d3a3056b23cbd02eb17238d1c3417bc0eece

diff --git a/src/Gui/PartWidget.cpp b/src/Gui/PartWidget.cpp
index bb5571e..96ccbc3 100644
--- a/src/Gui/PartWidget.cpp
+++ b/src/Gui/PartWidget.cpp
@@ -202,6 +202,18 @@ QString MultipartSignedWidget::quoteMe() const
     return quoteMeHelper(children());
 }
 
+bool MultipartSignedWidget::event(QEvent *e)
+{
+    if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) {
+        // Space is used by Qt for manipulating the checked/unchecked state, apparently.
+        // We don't use that, but we need the Space key for scrolling.
+        // In fact, this container should not accept any keyboard input anyway; it's just
+        // a visual indicator saying "hey, this is a signed piece of data".
+        return false;
+    }
+    return QGroupBox::event(e);
+}
+
 GenericMultipartWidget::GenericMultipartWidget(QWidget *parent,
         PartWidgetFactory *factory, const QModelIndex &partIndex,
         int recursionDepth, const UiUtils::PartLoadingOptions options):
diff --git a/src/Gui/PartWidget.h b/src/Gui/PartWidget.h
index c8a5046..6600a55 100644
--- a/src/Gui/PartWidget.h
+++ b/src/Gui/PartWidget.h
@@ -59,6 +59,7 @@ public:
                           const UiUtils::PartLoadingOptions loadingOptions);
     virtual QString quoteMe() const;
     virtual void reloadContents();
+    virtual bool event(QEvent *e);
 };
 
 /** @short Message quoting support for generic multipart/ * */



More information about the kde-doc-english mailing list