aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2019-12-16 19:05:52 +0100
committerAndré Hartmann <aha_1980@gmx.de>2019-12-17 13:33:03 +0000
commit6d0336f2231479951120c1128f9f95255612bd52 (patch)
treebe5efd1e3600402f977b9431dc90fb33aa5068af
parent17f47d6fa47dd213c3ce78059d2eef911e4bebe2 (diff)
CheckableMessageBox: Forbid focus for text and pixmapqds/v1.4.0-rc2
That allows changing between the buttons with the cursor Left and Right keys, without loosing focus from one of the buttons. Before, that was impossible without intermediate tab key pressing. E.g. when pressing Ctrl+W to close the git commit editor, the focus was outside the buttons. To select one of them, Tab had to be pressed first, but after some Key Right presses, the focus got away from the buttons again and the game had to be repeated. That behavior was different from QMessageBox, where one of the buttons always has focus. Change-Id: I9b12f794e8ba4aef1a68aaf249ba6dd6789cae4d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
-rw-r--r--src/libs/utils/checkablemessagebox.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libs/utils/checkablemessagebox.cpp b/src/libs/utils/checkablemessagebox.cpp
index 3ec411cfb3..ccf773cb99 100644
--- a/src/libs/utils/checkablemessagebox.cpp
+++ b/src/libs/utils/checkablemessagebox.cpp
@@ -62,6 +62,7 @@ public:
sizePolicy.setHeightForWidth(pixmapLabel->sizePolicy().hasHeightForWidth());
pixmapLabel->setSizePolicy(sizePolicy);
pixmapLabel->setVisible(false);
+ pixmapLabel->setFocusPolicy(Qt::NoFocus);
auto pixmapSpacer =
new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
@@ -71,6 +72,7 @@ public:
messageLabel->setWordWrap(true);
messageLabel->setOpenExternalLinks(true);
messageLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse);
+ messageLabel->setFocusPolicy(Qt::NoFocus);
auto checkBoxRightSpacer =
new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);