UI: Disable scene rename shortcut key while renaming
While editing a scene name, the Qt shortcut key for the renameScene action remained active. If the user pressed the shortcut key while actively editing a scene name, the widget would retrigger the action, causing the name edit to fail and discard the current changes to the scene name. The scene name would be reset to its previous saved value and reselected as if the user had pressed the shortcut key for the first time. This commit removes the QAction associated with the shortcut key from the scenes dock widget when editing starts and adds the action back to the widget once editing is done. Fixes #3044.master
parent
bf4a917751
commit
9cb36f803f
|
@ -302,12 +302,12 @@ OBSBasic::OBSBasic(QWidget *parent)
|
|||
connect(diskFullTimer, SIGNAL(timeout()), this,
|
||||
SLOT(CheckDiskSpaceRemaining()));
|
||||
|
||||
QAction *renameScene = new QAction(ui->scenesDock);
|
||||
renameScene = new QAction(ui->scenesDock);
|
||||
renameScene->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
connect(renameScene, SIGNAL(triggered()), this, SLOT(EditSceneName()));
|
||||
ui->scenesDock->addAction(renameScene);
|
||||
|
||||
QAction *renameSource = new QAction(ui->sourcesDock);
|
||||
renameSource = new QAction(ui->sourcesDock);
|
||||
renameSource->setShortcutContext(Qt::WidgetWithChildrenShortcut);
|
||||
connect(renameSource, SIGNAL(triggered()), this,
|
||||
SLOT(EditSceneItemName()));
|
||||
|
@ -4390,6 +4390,7 @@ void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,
|
|||
|
||||
void OBSBasic::EditSceneName()
|
||||
{
|
||||
ui->scenesDock->removeAction(renameScene);
|
||||
QListWidgetItem *item = ui->scenes->currentItem();
|
||||
Qt::ItemFlags flags = item->flags();
|
||||
|
||||
|
@ -5424,6 +5425,8 @@ void OBSBasic::SceneNameEdited(QWidget *editor,
|
|||
obs_source_t *source = obs_scene_get_source(scene);
|
||||
RenameListItem(this, ui->scenes, source, text);
|
||||
|
||||
ui->scenesDock->addAction(renameScene);
|
||||
|
||||
if (api)
|
||||
api->on_event(OBS_FRONTEND_EVENT_SCENE_LIST_CHANGED);
|
||||
|
||||
|
|
|
@ -282,6 +282,8 @@ private:
|
|||
QPointer<QMenu> deinterlaceMenu;
|
||||
QPointer<QMenu> perSceneTransitionMenu;
|
||||
QPointer<QObject> shortcutFilter;
|
||||
QPointer<QAction> renameScene;
|
||||
QPointer<QAction> renameSource;
|
||||
|
||||
QPointer<QWidget> programWidget;
|
||||
QPointer<QVBoxLayout> programLayout;
|
||||
|
|
Loading…
Reference in New Issue