tuna/danmaQ

Rewrite signal-slot connections in Qt 5 way

Harry-Chen opened this issue · 3 comments

RT. SIGNAL() and SLOT() is deprecated in Qt5, use function pointers instead.

FYI: when meeting overload functions, use syntax like:

// The modern Qt5 way with C++ 11
connect(combo, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &MainWindow::comboIndexChanged);
// The modern Qt5 way with C++ 14
connect(combo, qOverload<int>(&QComboBox::currentIndexChanged), this, &MainWindow::comboIndexChanged);

Or use lambdas.

Just do not cast function pointers...too ugly.

Done by @noirgif . Many thanks.