Prevent buttons from getting focus and activating from Enter key press

This commit is contained in:
GPayne
2022-03-03 16:03:42 -07:00
parent 9bd2c77f69
commit 69fb34908f
5 changed files with 11 additions and 0 deletions

View File

@@ -72,6 +72,8 @@ void DisplayWindowUnion::initializeLayout() {
"Add a window to the configuration (up to {} windows allowed)", _nMaxWindows
);
_addWindowButton->setToolTip(QString::fromStdString(addTip));
_addWindowButton->setFocusPolicy(Qt::NoFocus);
_removeWindowButton->setFocusPolicy(Qt::NoFocus);
layoutMonButton->addWidget(_removeWindowButton);
layoutMonButton->addStretch(1);
layoutMonButton->addWidget(_addWindowButton);

View File

@@ -39,12 +39,15 @@ FileSupport::FileSupport(QVBoxLayout* parentLayout,
QVBoxLayout* layoutFullVertical = new QVBoxLayout;
_saveButton = new QPushButton("Save As");
_saveButton->setToolTip("Save configuration changes (opens file chooser dialog)");
_saveButton->setFocusPolicy(Qt::NoFocus);
connect(_saveButton, &QPushButton::released, this, &FileSupport::save);
_cancelButton = new QPushButton("Cancel");
_cancelButton->setToolTip("Cancel changes");
_cancelButton->setFocusPolicy(Qt::NoFocus);
connect(_cancelButton, &QPushButton::released, this, &FileSupport::cancel);
_applyButton = new QPushButton("Apply Without Saving");
_applyButton->setToolTip("Apply configuration changes without saving to file");
_applyButton->setFocusPolicy(Qt::NoFocus);
connect(_applyButton, &QPushButton::released, this, &FileSupport::apply);
{
QHBoxLayout* layoutButtonBox = new QHBoxLayout;

View File

@@ -42,6 +42,7 @@ Orientation::Orientation()
"Opens a separate dialog for setting the pitch, "
"yaw, and roll of the camera\n(the orientation applies to all viewports)"
);
orientationButton->setFocusPolicy(Qt::NoFocus);
layoutOrientationControls->addWidget(orientationButton);
_layoutOrientationFull->addStretch(1);
_layoutOrientationFull->addLayout(layoutOrientationControls);

View File

@@ -92,10 +92,12 @@ OrientationDialog::OrientationDialog(sgct::quat& orientation, QWidget* parent)
QHBoxLayout* layoutButtonBox = new QHBoxLayout;
QPushButton* buttonSave = new QPushButton("OK");
buttonSave->setToolTip("Save global orientation changes");
buttonSave->setFocusPolicy(Qt::NoFocus);
layoutButtonBox->addStretch(1);
layoutButtonBox->addWidget(buttonSave);
QPushButton* buttonCancel = new QPushButton("Cancel");
buttonCancel->setToolTip("Cancel global orientation changes");
buttonCancel->setFocusPolicy(Qt::NoFocus);
layoutButtonBox->addWidget(buttonCancel);
layoutButtonBox->addStretch(1);
connect(buttonSave, &QPushButton::released, this, &OrientationDialog::ok);

View File

@@ -287,6 +287,7 @@ QVBoxLayout* WindowControl::initializeLayout() {
labelSize->setToolTip("Enter window width & height in pixels");
_sizeX->setToolTip("Enter window width (pixels)");
_sizeY->setToolTip("Enter window height (pixels)");
_buttonLockAspectRatio->setFocusPolicy(Qt::NoFocus);
_buttonLockAspectRatio->setToolTip("Locks/Unlocks size aspect ratio");
layoutSize->addWidget(labelSize);
labelSize->setText("Size:");
@@ -338,6 +339,7 @@ QVBoxLayout* WindowControl::initializeLayout() {
_fullscreenButton->setToolTip("If enabled, the window will be created in an "
"exclusive fullscreen mode. The size of this\nwindow will be set to the "
"screen resolution, and the window decoration automatically disabled.");
_fullscreenButton->setFocusPolicy(Qt::NoFocus);
layoutFullscreenButton->addWidget(_fullscreenButton);
layoutFullscreenButton->addStretch(1);
layoutCheckboxesFull2->addLayout(layoutFullscreenButton);
@@ -362,6 +364,7 @@ QVBoxLayout* WindowControl::initializeLayout() {
layoutComboProjection->addWidget(_buttonLockFov);
_buttonLockFov->setToolTip("Locks and scales the Horizontal & Vertical F.O.V. "
"to the ideal settings based on aspect ratio.");
_buttonLockFov->setFocusPolicy(Qt::NoFocus);
layoutComboProjection->addStretch(1);
layoutProjectionGroup->addLayout(layoutComboProjection);
QFrame* borderProjectionGroup = new QFrame;