QT : How To Save Path Once item is selected and button is pressed QListWidget
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
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QListWidget>
#include <QListWidgetItem>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; class MyWidget; }
QT_END_NAMESPACE
{
Q_OBJECT
private slots:
void on_pushButton_2_clicked();
private:
Ui::MainWindow *ui;
};
{
Q_OBJECT
public:
MainWindow
(QWidget *parent
= nullptr
);
~MainWindow();
private slots:
void on_pushButton_clicked();
void on_pushButton_2_clicked();
public:
Ui::MainWindow *ui;
public:
void Pathref();
void elfentestme();
};
#endif // MAINWINDOW_H
CPP
Code:
MyWidget
::MyWidget(QWidget *parent
){
}
{
if (!item)
return;
QMessageBox::information(this,
"",m_myListWidget
->row
(item
) + item
->text
());
}
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.