From $ROOTSYS/tutorials/gui/QtMultiFileDialog.C

// @(#)root/qt:$Name:  $:$Id$
// Author: Valeri Fine   23/03/2006
#ifndef __CINT__
#  include <QApplication>
#  include <QStyle>
#  include <QFileDialog>
#  include <QStringList>
#  include <QString>
#  include "TObjString.h"
#  include "TList.h"
#  include <string>
#endif
TList *QtMultiFileDialog(const char *style="") {
  // This is a small ROOT macro to use Qt 3.3 class :begin_html <a href="http://doc.trolltech.com/3.3/qfiledialog.html">QFileDialog</a> end_html
  // See: begin_html <a href="http://doc.trolltech.com/3.3/qfiledialog.html#getOpenFileNames">http://doc.trolltech.com/3.3/qfiledialog.html#getOpenFileNames</a> end_html
  //
  // To use, invoke ACLiC from the ROOT prompt:
  // root [] .x QtMultiFileDialog.C++
  //
  // To use it with no ACLiC, omit the trailing "++"
  // root [] .x QtMultiFileDialog.C
  //
  // The QtMultiFileDialog creates TList of TObjString objects and 
  // returns its pointer. 
  //
  // The "QtFileDialog.C" macro provides the simplified version of the "QtMultiFileDialog.C"
  //
  // Option: you can change the look and feel of the Qt file dialog
  // ======= by providing the optional parameter "style":
  //         The number of the available styles is defined by your local
  //         Qt installation. 
  //         Try: "windows", "motif", "kde", "platinum" etc
  //
  // The full list of the Qt classes available from Cint is defined by
  // begin_html <a href="http://root.bnl.gov/QtRoot/htmldoc/src/qtclasses.h.html">by $ROOTSYS/cint/lib/qtclasses.h</a> end_html
  //
  // All Qt classes can be used from ACLiC though.

#ifdef __CINT__
  // Load the qt cint dictionary.
  // One is recommended to do that at once somewhere.
  // For example from one's custom rootlogon.C script
  gSystem->Load("$ROOTSYS/cint/cint/include/qtcint");
#endif   
  QStyle *saveStyle =  0;
  if (!QString(style).isEmpty()) { 
     saveStyle = QApplication::style();
     QApplication::setStyle(style);
  }
  TList *listOfNames = new TList();
  QStringList files = QFileDialog::getOpenFileNames ();
  QStringList::Iterator it = files.begin();
  while ( it != files.end() ) {
      std::string flnm = (*it).toStdString();
      printf ("Next file selected: %s\n", flnm.c_str() );
      // Convert QString to TObjString and add it to the output
      listOfNames->Add(new TObjString(flnm.c_str()));
      ++it;
  }
  // Restore the style
  if (saveStyle) QApplication::setStyle(saveStyle);
  printf ("\nThe TList of the file names contains:");
  printf ("\n-------------------------------------\n");
  listOfNames->ls();
  return listOfNames;
}
 QtMultiFileDialog.C:1
 QtMultiFileDialog.C:2
 QtMultiFileDialog.C:3
 QtMultiFileDialog.C:4
 QtMultiFileDialog.C:5
 QtMultiFileDialog.C:6
 QtMultiFileDialog.C:7
 QtMultiFileDialog.C:8
 QtMultiFileDialog.C:9
 QtMultiFileDialog.C:10
 QtMultiFileDialog.C:11
 QtMultiFileDialog.C:12
 QtMultiFileDialog.C:13
 QtMultiFileDialog.C:14
 QtMultiFileDialog.C:15
 QtMultiFileDialog.C:16
 QtMultiFileDialog.C:17
 QtMultiFileDialog.C:18
 QtMultiFileDialog.C:19
 QtMultiFileDialog.C:20
 QtMultiFileDialog.C:21
 QtMultiFileDialog.C:22
 QtMultiFileDialog.C:23
 QtMultiFileDialog.C:24
 QtMultiFileDialog.C:25
 QtMultiFileDialog.C:26
 QtMultiFileDialog.C:27
 QtMultiFileDialog.C:28
 QtMultiFileDialog.C:29
 QtMultiFileDialog.C:30
 QtMultiFileDialog.C:31
 QtMultiFileDialog.C:32
 QtMultiFileDialog.C:33
 QtMultiFileDialog.C:34
 QtMultiFileDialog.C:35
 QtMultiFileDialog.C:36
 QtMultiFileDialog.C:37
 QtMultiFileDialog.C:38
 QtMultiFileDialog.C:39
 QtMultiFileDialog.C:40
 QtMultiFileDialog.C:41
 QtMultiFileDialog.C:42
 QtMultiFileDialog.C:43
 QtMultiFileDialog.C:44
 QtMultiFileDialog.C:45
 QtMultiFileDialog.C:46
 QtMultiFileDialog.C:47
 QtMultiFileDialog.C:48
 QtMultiFileDialog.C:49
 QtMultiFileDialog.C:50
 QtMultiFileDialog.C:51
 QtMultiFileDialog.C:52
 QtMultiFileDialog.C:53
 QtMultiFileDialog.C:54
 QtMultiFileDialog.C:55
 QtMultiFileDialog.C:56
 QtMultiFileDialog.C:57
 QtMultiFileDialog.C:58
 QtMultiFileDialog.C:59
 QtMultiFileDialog.C:60
 QtMultiFileDialog.C:61
 QtMultiFileDialog.C:62
 QtMultiFileDialog.C:63
 QtMultiFileDialog.C:64
 QtMultiFileDialog.C:65
 QtMultiFileDialog.C:66
 QtMultiFileDialog.C:67