UI: Disable hotkeys when a user is expected to type text
Disable hotkeys when a user starts an interaction with the UI where they are expected to type text and re-enable hotkeys when the interaction is completed.master
parent
ee30a83a6f
commit
f832d14220
|
@ -376,6 +376,7 @@ void SourceTreeItem::EnterEditMode()
|
|||
editor->installEventFilter(this);
|
||||
boxLayout->insertWidget(index, editor);
|
||||
setFocusProxy(editor);
|
||||
App()->DisableHotkeys();
|
||||
}
|
||||
|
||||
void SourceTreeItem::ExitEditMode(bool save)
|
||||
|
@ -415,6 +416,7 @@ void SourceTreeItem::ExitEditModeInternal(bool save)
|
|||
setFocusPolicy(Qt::NoFocus);
|
||||
boxLayout->insertWidget(index, label);
|
||||
label->setFocus();
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
|
||||
/* ----------------------------------------- */
|
||||
/* check for empty string */
|
||||
|
|
|
@ -936,6 +936,7 @@ void OBSBasicFilters::EditItem(QListWidgetItem *item, bool async)
|
|||
list->editItem(item);
|
||||
item->setFlags(flags);
|
||||
editActive = true;
|
||||
App()->DisableHotkeys();
|
||||
}
|
||||
|
||||
void OBSBasicFilters::DuplicateItem(QListWidgetItem *item)
|
||||
|
@ -1107,6 +1108,7 @@ void OBSBasicFilters::FilterNameEdited(QWidget *editor, QListWidget *list)
|
|||
listItem->setText(QString());
|
||||
SetupVisibilityItem(list, listItem, filter);
|
||||
editActive = false;
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
}
|
||||
|
||||
void OBSBasicFilters::AsyncFilterNameEdited(
|
||||
|
|
|
@ -67,6 +67,7 @@ OBSBasicInteraction::OBSBasicInteraction(QWidget *parent, OBSSource source_)
|
|||
};
|
||||
|
||||
connect(ui->preview, &OBSQTDisplay::DisplayCreated, addDrawCallback);
|
||||
App()->DisableHotkeys();
|
||||
}
|
||||
|
||||
OBSBasicInteraction::~OBSBasicInteraction()
|
||||
|
@ -74,6 +75,7 @@ OBSBasicInteraction::~OBSBasicInteraction()
|
|||
// since QT fakes a mouse movement while destructing a widget
|
||||
// remove our event filter
|
||||
ui->preview->removeEventFilter(eventFilter.get());
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
}
|
||||
|
||||
OBSEventFilter *OBSBasicInteraction::BuildEventFilter()
|
||||
|
|
|
@ -4830,6 +4830,7 @@ void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,
|
|||
|
||||
void OBSBasic::EditSceneName()
|
||||
{
|
||||
App()->DisableHotkeys();
|
||||
ui->scenesDock->removeAction(renameScene);
|
||||
QListWidgetItem *item = ui->scenes->currentItem();
|
||||
Qt::ItemFlags flags = item->flags();
|
||||
|
@ -5063,7 +5064,9 @@ void OBSBasic::on_actionAddScene_triggered()
|
|||
|
||||
void OBSBasic::on_actionRemoveScene_triggered()
|
||||
{
|
||||
App()->DisableHotkeys();
|
||||
RemoveSelectedScene();
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
}
|
||||
|
||||
void OBSBasic::ChangeSceneIndex(bool relative, int offset, int invalidIdx)
|
||||
|
@ -5753,6 +5756,8 @@ void OBSBasic::on_actionRemoveSource_triggered()
|
|||
if (!confirmed)
|
||||
return;
|
||||
|
||||
App()->DisableHotkeys();
|
||||
|
||||
/* ----------------------------------------------- */
|
||||
/* save undo data */
|
||||
|
||||
|
@ -5783,6 +5788,7 @@ void OBSBasic::on_actionRemoveSource_triggered()
|
|||
}
|
||||
|
||||
CreateSceneUndoRedoAction(action_name, undo_data, redo_data);
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionInteract_triggered()
|
||||
|
@ -6068,6 +6074,7 @@ static void RenameListItem(OBSBasic *parent, QListWidget *listWidget,
|
|||
void OBSBasic::SceneNameEdited(QWidget *editor,
|
||||
QAbstractItemDelegate::EndEditHint endHint)
|
||||
{
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
OBSScene scene = GetCurrentScene();
|
||||
QLineEdit *edit = qobject_cast<QLineEdit *>(editor);
|
||||
string text = QT_TO_UTF8(edit->text().trimmed());
|
||||
|
|
|
@ -214,6 +214,8 @@ OBSBasicProperties::OBSBasicProperties(QWidget *parent, OBSSource source_)
|
|||
} else {
|
||||
preview->hide();
|
||||
}
|
||||
|
||||
App()->DisableHotkeys();
|
||||
}
|
||||
|
||||
OBSBasicProperties::~OBSBasicProperties()
|
||||
|
@ -224,6 +226,7 @@ OBSBasicProperties::~OBSBasicProperties()
|
|||
obs_source_dec_showing(source);
|
||||
main->SaveProject();
|
||||
main->UpdateContextBar();
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
}
|
||||
|
||||
void OBSBasicProperties::AddPreviewButton()
|
||||
|
|
|
@ -297,11 +297,13 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
|||
obs_sceneitem_release(item);
|
||||
}
|
||||
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
done(DialogCode::Accepted);
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::on_buttonBox_rejected()
|
||||
{
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
done(DialogCode::Rejected);
|
||||
}
|
||||
|
||||
|
@ -376,6 +378,8 @@ OBSBasicSourceSelect::OBSBasicSourceSelect(OBSBasic *parent, const char *id_,
|
|||
} else {
|
||||
obs_enum_sources(EnumSources, this);
|
||||
}
|
||||
|
||||
App()->DisableHotkeys();
|
||||
}
|
||||
|
||||
void OBSBasicSourceSelect::SourcePaste(const char *name, bool visible, bool dup)
|
||||
|
|
|
@ -67,6 +67,7 @@ bool NameDialog::AskForName(QWidget *parent, const QString &title,
|
|||
const QString &text, std::string &userTextInput,
|
||||
const QString &placeHolder, int maxSize)
|
||||
{
|
||||
App()->DisableHotkeys();
|
||||
if (maxSize <= 0 || maxSize > 32767)
|
||||
maxSize = 170;
|
||||
|
||||
|
@ -84,6 +85,7 @@ bool NameDialog::AskForName(QWidget *parent, const QString &title,
|
|||
}
|
||||
userTextInput = dialog.userText->text().toUtf8().constData();
|
||||
CleanWhitespace(userTextInput);
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -94,6 +96,7 @@ bool NameDialog::AskForNameWithOption(QWidget *parent, const QString &title,
|
|||
bool &optionChecked,
|
||||
const QString &placeHolder)
|
||||
{
|
||||
App()->DisableHotkeys();
|
||||
NameDialog dialog(parent);
|
||||
dialog.setWindowTitle(title);
|
||||
|
||||
|
@ -110,5 +113,6 @@ bool NameDialog::AskForNameWithOption(QWidget *parent, const QString &title,
|
|||
userTextInput = dialog.userText->text().toUtf8().constData();
|
||||
CleanWhitespace(userTextInput);
|
||||
optionChecked = dialog.checkbox->isChecked();
|
||||
App()->UpdateHotkeyFocusSetting();
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue