Skip to content

frontend: Update invokeMethod to use function pointers - #13344

Open
Warchamp7 wants to merge 1 commit into
obsproject:masterfrom
Warchamp7:remove-string-invokes
Open

frontend: Update invokeMethod to use function pointers#13344
Warchamp7 wants to merge 1 commit into
obsproject:masterfrom
Warchamp7:remove-string-invokes

Conversation

@Warchamp7

Copy link
Copy Markdown
Member

Description

Updates all frontend uses of invokeMethod with function pointers or lambdas.

Important

This PR is blocked until we drop support for Ubuntu 24.04 as this style of calling invokeMethod is not supported on Qt 6.5

Motivation and Context

Makes it easier to update or refactor code without having to worry about string references to slot functions.

How Has This Been Tested?

Compiled OBS and performed a few basic tests. I have not tested thoroughly yet.

Types of changes

  • Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@Warchamp7
Warchamp7 force-pushed the remove-string-invokes branch from bc279ba to 1abf29d Compare April 20, 2026 20:58
@Warchamp7 Warchamp7 added the kind/cleanup Non-breaking change which makes code smaller or more readable label Apr 21, 2026
@Warchamp7 Warchamp7 added this to the OBS Studio 33.0 milestone May 4, 2026
@github-project-automation github-project-automation Bot moved this to Ready For Review in 33.0 Release Tracker Jun 16, 2026
@Warchamp7
Warchamp7 force-pushed the remove-string-invokes branch 2 times, most recently from b3d8afa to a2170fb Compare July 15, 2026 18:44
@Warchamp7 Warchamp7 changed the title frontend: Update invokeMethod to use functions frontend: Update invokeMethod to use function pointers Jul 15, 2026
@Warchamp7
Warchamp7 force-pushed the remove-string-invokes branch from a2170fb to a1efe78 Compare July 21, 2026 19:26
@Warchamp7
Warchamp7 force-pushed the remove-string-invokes branch from a1efe78 to 267096d Compare July 21, 2026 19:26
Comment thread frontend/OBSStudioAPI.cpp
} else {
QMetaObject::invokeMethod(main, "SetCurrentScene", WaitConnection(), Q_ARG(OBSSource, OBSSource(scene)),
Q_ARG(bool, false));
QMetaObject::invokeMethod(main, qOverload<OBSSource, bool>(&OBSBasic::SetCurrentScene),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does qOverload do here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OBSBasic has two functions named SetCurrentScene.

void SetCurrentScene(obs_scene_t *scene, bool force = false);
void SetCurrentScene(OBSSource scene, bool force = false);

qOverload is for resolving it.

Selecting Overloaded Signals and Slots

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Non-breaking change which makes code smaller or more readable

Projects

Status: Ready For Review

Development

Successfully merging this pull request may close these issues.

2 participants