This is a small ROOT macro to use Qt 3.3 class :QFileDialog See: https://doc.qt.io/archives/3.3/qfiledialog.html#getOpenFileNames
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 by $ROOTSYS/cint/lib/qtclasses.h
All Qt classes can be used from ACLiC though.
# include <QApplication>
# include <QStyle>
# include <QFileDialog>
# include <QStringList>
# include <QString>
# include <string>
QStyle *saveStyle = 0;
if (!QString(
style).isEmpty()) {
QApplication::setStyle(
style);
}
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() );
++it;
}
if (saveStyle) QApplication::setStyle(saveStyle);
printf ("\nThe TList of the file names contains:");
printf ("\n-------------------------------------\n");
return listOfNames;
}
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
virtual void Add(TObject *obj)
Collectable string class.
- Author
- Valeri Fine 23/03/2006
Definition in file QtMultiFileDialog.C.