Hello! How to make connect with different arguments (qint64 and int)?
connect(player, SIGNAL(positionChanged(qint64)), ui->clock, SLOT(display(int))); player - QMediaPlayer || clock - QLCDNumber
Try this (qt5 syntax). The idea should be given automatically
QObject::connect(player, &QMediaPlayer::positionChanged, ui->clock, &QLCDNumber::display); EDIT
Unfortunately, QLCDNumber has several display (int, double) slots. Which compiler to use is unclear and it needs to be explicitly stated to it:
QObject::connect(player, &QMediaPlayer::positionChanged, ui->clock, static_cast<void(QLCDNumber::*)(int)>(&QLCDNumber::display)); Or use lambda
QObject::connect(player, &QMediaPlayer::positionChanged, this, [this](qint64 _arg) { ui->clock->display(static_cast<int>(_arg)); }); Any of this should work =)
Source: https://ru.stackoverflow.com/questions/647205/
All Articles