Skip to content

frontend: Use Q_OBJECT macro for BrowserDock#11785

Merged
RytoEX merged 1 commit intoobsproject:masterfrom
cg2121:qobject-macro
May 1, 2025
Merged

frontend: Use Q_OBJECT macro for BrowserDock#11785
RytoEX merged 1 commit intoobsproject:masterfrom
cg2121:qobject-macro

Conversation

@cg2121
Copy link
Copy Markdown
Contributor

@cg2121 cg2121 commented Jan 28, 2025

Description

This is needed as the BrowserDock is a QObject.

Motivation and Context

Without this, #11784 fails to compile

How Has This Been Tested?

Compiled and ran OBS

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

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

@cg2121 cg2121 added kind/bug Categorizes issue or PR as related to a bug. area/ui-ux Anything to do with changes or additions to UI/UX elements. labels Jan 28, 2025
Copy link
Copy Markdown
Collaborator

@Lain-B Lain-B left a comment

Choose a reason for hiding this comment

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

I suppose this is fine.

Copy link
Copy Markdown
Member

@PatTheMav PatTheMav left a comment

Choose a reason for hiding this comment

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

This will require the source file to include the generated moc file as well, as adding Q_OBJECT will trigger such a pre-compilation iirc.

This is needed as the BrowserDock is a QObject.
@cg2121
Copy link
Copy Markdown
Contributor Author

cg2121 commented Feb 8, 2025

Updated to also include the moc file.

Copy link
Copy Markdown
Member

@RytoEX RytoEX left a comment

Choose a reason for hiding this comment

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

Looks okay.

@RytoEX RytoEX requested a review from PatTheMav April 28, 2025 22:12
@RytoEX RytoEX self-assigned this Apr 28, 2025
Copy link
Copy Markdown
Member

@PatTheMav PatTheMav left a comment

Choose a reason for hiding this comment

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

Interesting that the "identity" of the final object is not inherited, even though it inherits from OBSDock which does have the Q_OBJECT decoration.

@RytoEX RytoEX added this to the OBS Studio 31.1 milestone May 1, 2025
@RytoEX RytoEX merged commit 47360a9 into obsproject:master May 1, 2025
@cg2121 cg2121 deleted the qobject-macro branch May 21, 2025 02:37
@Warchamp7
Copy link
Copy Markdown
Member

Interesting that the "identity" of the final object is not inherited, even though it inherits from OBSDock which does have the Q_OBJECT decoration.

The Q_OBJECT macro tells Qt to generate MOC functions for the class and I don't think there's any way for it to automatically do that for something strictly based off subclassing.

This will require the source file to include the generated moc file as well, as adding Q_OBJECT will trigger such a pre-compilation iirc.

This is not actually required afaik because of AUTOMOC in the Cmake files, though Qt will detect when a moc file is included explicitly, which can prevent multiple definition errors (As I learned recently working on properties-view stuff)

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

Labels

area/ui-ux Anything to do with changes or additions to UI/UX elements. kind/bug Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants