Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/OBSStudioAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void OBSStudioAPI::obs_frontend_set_current_scene_collection(const char *collect
QVariant v = action->property("file_name");

if (v.typeName() != nullptr) {
if (action->text() == qstrCollection) {
if (action->property("collection_name").toString() == qstrCollection) {
action->trigger();
break;
}
Expand Down Expand Up @@ -195,7 +195,7 @@ void OBSStudioAPI::obs_frontend_set_current_profile(const char *profile)
QVariant v = action->property("file_name");

if (v.typeName() != nullptr) {
if (action->text() == qstrProfile) {
if (action->property("profile_name").toString() == qstrProfile) {
action->trigger();
break;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/dialogs/OBSBasicFilters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ QMenu *OBSBasicFilters::CreateAddFilterPopupMenu(bool async)
if (!filter_compatible(async, sourceFlags, filterFlags))
continue;

QAction *popupItem = new QAction(QT_UTF8(type.name.c_str()), this);
QAction *popupItem = new QAction(EscapeMenuItem(QT_UTF8(type.name.c_str())), this);
popupItem->setData(QT_UTF8(type.type.c_str()));
connect(popupItem, &QAction::triggered, [this, type]() { AddNewFilter(type.type.c_str()); });
popup->addAction(popupItem);
Expand Down
2 changes: 1 addition & 1 deletion frontend/widgets/OBSBasic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ private slots:
auto projectors = GetProjectorMenuMonitorsFormatted();
for (int i = 0; i < projectors.size(); i++) {
QString str = projectors[i];
QAction *action = parent->addAction(str, target, slot);
QAction *action = parent->addAction(EscapeMenuItem(str), target, slot);
action->setProperty("monitor", i);
}
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/widgets/OBSBasic_Profiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ void OBSBasic::RefreshProfiles(bool refreshCache)
const OBSProfile &profile = profiles.at(profileName);
const QString qProfileName = QString().fromStdString(profileName);

QAction *action = new QAction(qProfileName, this);
QAction *action = new QAction(EscapeMenuItem(qProfileName), this);
action->setProperty("profile_name", qProfileName);
action->setProperty("file_name", QString().fromStdString(profile.directoryName));
connect(action, &QAction::triggered, this, &OBSBasic::ChangeProfile);
Expand Down
2 changes: 1 addition & 1 deletion frontend/widgets/OBSBasic_SceneCollections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void OBSBasic::RefreshSceneCollections(bool refreshCache)
const SceneCollection &collection = collections.at(collectionName);
const QString qCollectionName = QString().fromStdString(collectionName);

QAction *action = new QAction(qCollectionName, this);
QAction *action = new QAction(EscapeMenuItem(qCollectionName), this);
action->setProperty("collection_name", qCollectionName);
action->setProperty("file_name", QString().fromStdString(collection.getFileName()));
connect(action, &QAction::triggered, this, &OBSBasic::ChangeSceneCollection);
Expand Down
2 changes: 1 addition & 1 deletion frontend/widgets/OBSBasic_SceneItems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ QMenu *OBSBasic::CreateAddSourcePopupMenu()
};

auto addSource = [this, getActionAfter](QMenu *popup, const char *type, const char *name) {
QString qname = QT_UTF8(name);
QString qname = EscapeMenuItem(QT_UTF8(name));
QAction *popupItem = new QAction(qname, this);
connect(popupItem, &QAction::triggered, [this, type]() { AddSource(type); });

Expand Down
6 changes: 3 additions & 3 deletions frontend/widgets/OBSBasic_Transitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void OBSBasic::on_transitionAdd_clicked()
while (obs_enum_transition_types(idx++, &id)) {
if (obs_is_source_configurable(id)) {
const char *name = obs_source_get_display_name(id);
QAction *action = new QAction(name, this);
QAction *action = new QAction(EscapeMenuItem(QT_UTF8(name)), this);

connect(action, &QAction::triggered, [this, id]() { AddTransition(id); });

Expand Down Expand Up @@ -840,7 +840,7 @@ QMenu *OBSBasic::CreatePerSceneTransitionMenu()
if (!name || !*name)
name = Str("None");

action = menu->addAction(QT_UTF8(name));
action = menu->addAction(EscapeMenuItem(QT_UTF8(name)));
action->setProperty("transition_uuid", QString::fromStdString(uuid));
action->setCheckable(true);
action->setChecked(match);
Expand Down Expand Up @@ -999,7 +999,7 @@ QMenu *OBSBasic::CreateVisibilityTransitionMenu(bool visible)
while (obs_enum_transition_types(idx++, &id)) {
const char *name = obs_source_get_display_name(id);
const bool match = id && curId && strcmp(id, curId) == 0;
action = menu->addAction(QT_UTF8(name));
action = menu->addAction(EscapeMenuItem(QT_UTF8(name)));
action->setProperty("transition_id", QT_UTF8(id));
action->setCheckable(true);
action->setChecked(match);
Expand Down
5 changes: 5 additions & 0 deletions shared/qt/wrappers/qt-wrappers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,8 @@ void RefreshToolBarStyling(QToolBar *toolBar)
widget->style()->polish(widget);
}
}

QString EscapeMenuItem(QString name)
{
return name.replace("&", "&&");
}
2 changes: 2 additions & 0 deletions shared/qt/wrappers/qt-wrappers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,5 @@ QStringList OpenFiles(QWidget *parent, QString title, QString path, QString exte
void TruncateLabel(QLabel *label, QString newText, int length = MAX_LABEL_LENGTH);

void RefreshToolBarStyling(QToolBar *toolBar);

QString EscapeMenuItem(QString name);