'how to run a membber function with QtConcurrrent Qt6? type 'decay_t cannot be used prior to '::' because it has no members)

i'm trying to run a member function but but i got an error , help me please

i tried with this line of code

QFuture<qlonglong> future = QtConcurrent::run(this,&backD::analysa);

this is a screen shot 'lol' of the errors and analysa() is a methode that returns a qlonglong



Solution 1:[1]

Try QtConcurrent::run([this]{ return analysa(); }); or QtConcurrent::run([this] -> qlonglong { return analysa(); });, whichever compiles in your case.

Solution 2:[2]

i tried many version before asking here and the QtConcurrent::run(this->analysa()); is one of them, i'ts looks like the lambda form works only with void and i'm using qlonglong. her is my the member methode analysa

 qlonglong  backD::analysa()
{
QString currentPath = tabWidget::currentWidget()->fsCurrentPath();
qlonglong size=0;

QDirIterator it(currentPath,QStringList()<<"*.*",QDir::Files,QDirIterator::Subdirectories);
while(it.hasNext())
{


    QFileInfo infos(it.next());

    size += infos.size();

}
return size;}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HiFile the best file manager
Solution 2