Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly give signals and slots when calling connect #2797

Open
oktomus opened this issue Mar 8, 2020 · 3 comments
Open

Explicitly give signals and slots when calling connect #2797

oktomus opened this issue Mar 8, 2020 · 3 comments

Comments

@oktomus
Copy link
Member

oktomus commented Mar 8, 2020

Instead of doing

connect(
    m_viewport_widget, SIGNAL(customContextMenuRequested(const QPoint&)),
    SLOT(slot_viewport_widget_context_menu(const QPoint&)));

do

connect(
    m_viewport_widget, &ViewportWidget::customContextMenuRequested,
    this, &FinalRenderViewportTab::slot_viewport_widget_context_menu);

This allows to detect connect errors at compile time instead of runtime.
Also, navigating to signals or slots in Visual Studio is easier.

For signals or slots that have multiple arg possibilities, you can specify which one to chose with qOverload. Example, this

connect(
    m_display_transform_combo, SIGNAL(currentIndexChanged(QString)),
    m_viewport_widget, SLOT(slot_display_transform_changed(QString)));

becomes

connect(
    m_display_transform_combo, qOverload<const QString&>(&QComboBox::currentIndexChanged),
    m_viewport_widget, &ViewportWidget::slot_display_transform_changed);
@LeaBroudo
Copy link
Contributor

I'd like to work on this issue, as I'm new to appleseed. Are there any particular files I can find this in? grep is taking a bit too long.

@oktomus
Copy link
Member Author

oktomus commented Mar 20, 2020

@LeaBroudo run grep in a specific folder. For instance src/appleseed.studio.

@LeaBroudo
Copy link
Contributor

Got it! I'll start on it now.

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

No branches or pull requests

3 participants