Good Morning, Evening

I am trying to get to terms with QT i am new so sorry if i ask stupid questions,

however what i am tying to accomplish i have got directory listing all the folders in a certain directory,

however once i have selected a i item i want to save i cant seem to do this as i not quite sure how to create a signal and slot for a button press and item select,

this is the code i do have so far.
.H
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include <QListWidget>
  6. #include <QListWidgetItem>
  7.  
  8. QT_BEGIN_NAMESPACE
  9. namespace Ui { class MainWindow; class MyWidget; }
  10. QT_END_NAMESPACE
  11.  
  12. class MyWidget : public QWidget
  13. {
  14. Q_OBJECT
  15. MyWidget(QWidget *parent = 0);
  16.  
  17. private slots:
  18. void itemClicked(QListWidgetItem *item);
  19.  
  20. void on_pushButton_2_clicked();
  21.  
  22. private:
  23. QListWidget *m_myListWidget;
  24. Ui::MainWindow *ui;
  25.  
  26. };
  27.  
  28. class MainWindow : public QMainWindow
  29. {
  30. Q_OBJECT
  31.  
  32. public:
  33. MainWindow(QWidget *parent = nullptr);
  34. ~MainWindow();
  35.  
  36.  
  37.  
  38. private slots:
  39. void on_pushButton_clicked();
  40.  
  41. void on_pushButton_2_clicked();
  42.  
  43. void OnItemSelected( QListWidgetItem* item );
  44. public:
  45. Ui::MainWindow *ui;
  46.  
  47.  
  48.  
  49.  
  50. public:
  51. void Pathref();
  52. void elfentestme();
  53. };
  54. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

CPP
Qt Code:
  1. MyWidget::MyWidget(QWidget *parent)
  2. : QWidget(parent)
  3. {
  4. m_myListWidget = new QListWidget(this);
  5. connect(ui->listWidget, SIGNAL(itemClicked(QListWidgetItem *)), SLOT(itemClicked (QListWidgetItem *)));
  6. }
  7.  
  8. void MyWidget::itemClicked(QListWidgetItem *item)
  9. {
  10. if (!item)
  11. return;
  12. QMessageBox::information(this,"",m_myListWidget->row(item) + item->text());
  13. }
To copy to clipboard, switch view to plain text mode 

but cant seem to link button at all i looked up tutorials on YouTube and on QT Help

but cant seem to get this to work trying to select a item and then i have a button that says save and pressing that i want to save the full dir path
but for some reason it does nothing,

and am still using the mainwindow.h
and cpp

because i cant seem to get the ui reference on my own cpp and h files.