forked from qt-creator/qt-creator
CheckableMessageBox: Forbid focus for text and pixmap
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>
This commit is contained in:
committed by
André Hartmann
parent
17f47d6fa4
commit
6d0336f223
@@ -62,6 +62,7 @@ public:
|
|||||||
sizePolicy.setHeightForWidth(pixmapLabel->sizePolicy().hasHeightForWidth());
|
sizePolicy.setHeightForWidth(pixmapLabel->sizePolicy().hasHeightForWidth());
|
||||||
pixmapLabel->setSizePolicy(sizePolicy);
|
pixmapLabel->setSizePolicy(sizePolicy);
|
||||||
pixmapLabel->setVisible(false);
|
pixmapLabel->setVisible(false);
|
||||||
|
pixmapLabel->setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
auto pixmapSpacer =
|
auto pixmapSpacer =
|
||||||
new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
new QSpacerItem(0, 5, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||||
@@ -71,6 +72,7 @@ public:
|
|||||||
messageLabel->setWordWrap(true);
|
messageLabel->setWordWrap(true);
|
||||||
messageLabel->setOpenExternalLinks(true);
|
messageLabel->setOpenExternalLinks(true);
|
||||||
messageLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse);
|
messageLabel->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse);
|
||||||
|
messageLabel->setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
auto checkBoxRightSpacer =
|
auto checkBoxRightSpacer =
|
||||||
new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
|
Reference in New Issue
Block a user