lundi 25 juin 2018

How to display the names of all files in a folder in a window? Qt c++

In the software I'm creating, I have a window where I want to list all the files below each other. I tried a solution but the list is too small compared to the size of the window ....I would like the list to take up all the space of my window.

Here is my code :

viewList::viewList(){

QString path="/home/myFolder";
QListWidget *listwidget=new QListWidget;
QVBoxLayout *vbox=new QVBoxLayout;

foreach(QString file, files){

    listwidget->addItem(file);
    vbox->addWidget(listwidget);
}
  this->setLayout(vbox);
}

et dans le .h :

class viewList : public QWidget{
 ///
}

Has anyone ever had this problem to solve? Thank you

Aucun commentaire:

Enregistrer un commentaire