Click a directory in listWidget and display images on another listWidget

I am trying to display images in separate widget when I choose a directory from another listWidget. In that case I don't know how can I click a directory and do something . I mean how can I connect a click action on a directory and send out put in another widget.(just 1 click on a dir(in separate widget) and display images (inside this selected dir) on another listWidget. Here is my current code.

QDir directory = QFileDialog::getExistingDirectory(this, tr("Open Directory"),"/home",                                                                                                            QFileDialog::ShowDirsOnly| QFileDialog::DontResolveSymlinks);

    for(const QFileInfo & finfo: directory.entryInfoList()){

    connect(ui->listWidget, & QListWidget::itemClicked,[listWidget_2,this](QListWidgetItem *item)

   item->setNameFilters({"*.png", "*.jpg"});

    for(const QFileInfo & finfo: item.entryInfoList()){
        QListWidgetItem *img = new QListWidgetItem(QIcon(finfo.absoluteFilePath()), finfo.fileName());

   ("selecteditem"from listWidget).setNameFilters({"*.png", "*.jpg"});

    for(const QFileInfo & finfo: ("selecteditem"from listWidget).entryInfoList()){
        QListWidgetItem *item = new QListWidgetItem(QIcon(finfo.absoluteFilePath()), finfo.fileName());