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

Replace deprecated QSignalMapper with lambda expressions #2427

Merged
merged 32 commits into from
Jan 14, 2020

Conversation

Holzhaus
Copy link
Member

@Holzhaus Holzhaus commented Jan 7, 2020

This fixes a bunch of -Wdeprecated-declarations warnings. Please review thorougly, I'm not that experienced with lambda expressions. ;-)

@Holzhaus
Copy link
Member Author

Holzhaus commented Jan 7, 2020

Oh, the CI builds failed because we need at least Qt 5.6 to use lambdas with QMenu::addAction().

src/controllers/controlpickermenu.cpp Outdated Show resolved Hide resolved
src/library/autodj/autodjfeature.cpp Outdated Show resolved Hide resolved
src/widget/wtracktableview.cpp Outdated Show resolved Hide resolved
@Holzhaus
Copy link
Member Author

Holzhaus commented Jan 9, 2020

@daschuer I fixed the remaining issues (hopefully) and also deduplicated the controlpickermenu.cpp code a little.

@daschuer
Copy link
Member

Mmm .. rebasing a 500 lines a PR under review does not work well, because instead of reading your fixes, I now have to read everything again. Rebasing und review should only be done after talking to the reviewer.

@daschuer
Copy link
Member

Ah, nevermind. It is not too bad. I hope I find time to have a look and manual test.

@Holzhaus
Copy link
Member Author

Holzhaus commented Jan 10, 2020

Sorry I just fixed up the last two commits that you didn't review yet anyway.

@uklotzde
Copy link
Contributor

IMHO rebasing is a viable option for technical PRs like this one that suffer from our broad range of supported platforms and versions. Otherwise we would need to mark each opened PR by default as work-in-progress until all CI builds succeeded. Without rebasing there would be intermediate versions that don't build successfully.

Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

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

We should avoid to use std::unique_ptr for objects that are already managed by Qt.

src/controllers/controlpickermenu.cpp Outdated Show resolved Hide resolved
src/controllers/controlpickermenu.h Outdated Show resolved Hide resolved
src/widget/wtracktableview.cpp Outdated Show resolved Hide resolved
@daschuer
Copy link
Member

.. Without rebasing there would be intermediate versions that don't build successfully.

Yes indeed, that is a very good reason for debasing a PR. In this case I was probably complaining unjustified.

Also, in a case we have only one faulty HEAD commit with no usable change else, a rebase of this single commit is also a good thing. Just keep in mind the extra review effort before deciding for a rebase.
It is finally an issue about good communication ...

@uklotzde
Copy link
Contributor

The failure of the Windows build on AppVeyor is unrelated.

@uklotzde uklotzde added this to the 2.3.0 milestone Jan 12, 2020
@uklotzde
Copy link
Contributor

Ping @daschuer

@daschuer
Copy link
Member

I like to do manual test before merge.
Hopefully I will find time soon.

Copy link
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

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

I have added some optional minor comments. The PR looks good. Will test tonight.

src/controllers/controlpickermenu.cpp Outdated Show resolved Hide resolved
src/controllers/controlpickermenu.cpp Outdated Show resolved Hide resolved

if (addReset) {
QString resetMenuTitle = QString("%1 (%2)").arg(controlTitle, m_resetStr);
QString resetMenuDescription = QString("%1 (%2)").arg(controlDescription, m_resetStr);
QString resetTitle = QString("%1 (%2)").arg(title, m_resetStr);
Copy link
Member

Choose a reason for hiding this comment

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

Here and nelow, we can make use of QStringBuilder and QStringLiteral:

Titel + QStringLiteral (" (") + m_resetStr + QChar(')');

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this giving more performance? Because I think it's less readable.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, because it does not create the intermediate "%1 (%2)" string from char[] and there is no string parsing for %. But readability is also a high value ... I don't mind.

[=](bool) { m_crateMapper.map(); });
int iCrateId = crate.getId().value();
connect(pAction.get(), &QAction::triggered,
this, [this, iCrateId] { slotAddCrateToAutoDj(iCrateId); });
Copy link
Member

Choose a reason for hiding this comment

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

This one does not work anymore ... but why?

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, master is also effected.

Copy link
Member

Choose a reason for hiding this comment

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

I will file a bug

Copy link
Member

Choose a reason for hiding this comment

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

@daschuer
Copy link
Member

Works and looks good now. Thank you very much.
Thank you for helping to get rid of all string based connect calls.

@daschuer daschuer merged commit da3c3af into mixxxdj:master Jan 14, 2020
@uklotzde
Copy link
Contributor

uklotzde commented Jan 16, 2020

Adding tracks to crates through the check boxes in the context menu fails:

#0  0x00007ffff42cd5cc in QMetaObject::cast(QObject const*) const () at /lib64/libQt5Core.so.5
#1  0x00000000006f5ddd in qobject_cast<QCheckBox*>(QObject*) (object=<optimized out>) at /usr/include/qt5/QtCore/qobject.h:503
#2  WTrackTableView::updateSelectionCrates(QWidget*) (this=0x87cb020, pWidget=<optimized out>) at /tmp/mixxx/src/widget/wtracktableview.cpp:1876
#3  0x00007ffff42eead0 in QMetaObject::activate(QObject*, int, int, void**) () at /lib64/libQt5Core.so.5
#4  0x00007ffff6ef9162 in QCheckBox::stateChanged(int) () at /lib64/libQt5Widgets.so.5
#5  0x00007ffff6eea0b0 in QAbstractButtonPrivate::click() () at /lib64/libQt5Widgets.so.5
#6  0x00007ffff6eea2d5 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /lib64/libQt5Widgets.so.5
#7  0x00007ffff6e34c7e in QWidget::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#8  0x00007ffff6df1ab6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#9  0x00007ffff6dfb3a3 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#10 0x00007ffff42c4458 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#11 0x00007ffff6dfa4b7 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /lib64/libQt5Widgets.so.5
#12 0x00007ffff6e51614 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () at /lib64/libQt5Widgets.so.5
#13 0x00007ffff6e53c8c in QWidgetWindow::event(QEvent*) () at /lib64/libQt5Widgets.so.5
#14 0x00007ffff6df1ab6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#15 0x00007ffff6dfb150 in QApplication::notify(QObject*, QEvent*) () at /lib64/libQt5Widgets.so.5
#16 0x00007ffff42c4458 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib64/libQt5Core.so.5
#17 0x00007ffff66b5b83 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /lib64/libQt5Gui.so.5
#18 0x00007ffff66b737b in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /lib64/libQt5Gui.so.5
#19 0x00007ffff66936eb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Gui.so.5
#20 0x00007fffe1163d5e in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () at /lib64/libQt5XcbQpa.so.5
#21 0x00007ffff630c510 in g_main_context_dispatch () at /lib64/libglib-2.0.so.0
#22 0x00007ffff630c8a0 in g_main_context_iterate.isra () at /lib64/libglib-2.0.so.0
#23 0x00007ffff630c943 in g_main_context_iteration () at /lib64/libglib-2.0.so.0
#24 0x00007ffff4319895 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#25 0x00007ffff42c324b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib64/libQt5Core.so.5
#26 0x00007ffff42cb126 in QCoreApplication::exec() () at /lib64/libQt5Core.so.5
#27 0x000000000054acbd in (anonymous namespace)::runMixxx (args=..., app=0x7fffffffd120) at /tmp/mixxx/src/main.cpp:53
#28 main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /tmp/mixxx/src/main.cpp:130

Maybe a regression? I haven't done a bisect yet.

@Holzhaus
Copy link
Member Author

Maybe pCheckbox goes out of scope after being referenced in the lambda in lines 1745/1747 in wtracktableview.cpp. I'll have to check tomorrow if #2451 resolves the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
2.3 release
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants