Rewrite signal-slot connections in Qt 5 way
Harry-Chen opened this issue · 3 comments
Harry-Chen commented
RT. SIGNAL() and SLOT() is deprecated in Qt5, use function pointers instead.
jiegec commented
Harry-Chen commented
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.
Harry-Chen commented
Done by @noirgif . Many thanks.