ROOT
6.10/09
Reference Guide
tutorials
gui
QtFileDialog.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_gui
3
/// This is a small ROOT macro to use Qt 3.3 class: [QFileDialog](https://doc.qt.io/archives/3.3/qfiledialog.html)
4
/// See: [https://doc.qt.io/archives/3.3/qfiledialog.html#getOpenFileName](https://doc.qt.io/archives/3.3/qfiledialog.html#getOpenFileName)
5
///
6
/// To use, invoke ACLiC from the ROOT prompt:
7
/// ~~~
8
/// root [] .x QtFileDialog.C++
9
/// ~~~
10
///
11
/// To use it with no ACLiC, omit the trailing "++"
12
/// ~~~
13
/// root [] .x QtFileDialog.C
14
/// ~~~
15
///
16
/// The QtFileDialog returns TString object that contains the selected file name.
17
/// returns its pointer.
18
/// The macro QtMultiFileDialog.C provides an advanced example.
19
///
20
/// The full list of the Qt classes available from Cint is defined by
21
/// begin_html [by $ROOTSYS/cint/lib/qtclasses.h](http://root.bnl.gov/QtRoot/htmldoc/src/qtclasses.h.html)
22
///
23
/// All Qt classes can be used from ACLiC though.
24
///
25
/// \macro_code
26
///
27
/// \author Valeri Fine 23/03/2006
28
29
# include <QFileDialog>
30
# include <QString>
31
# include "
TString.h
"
32
# include <string>
33
34
35
TString
QtFileDialog() {
36
QString fileName = QFileDialog::getOpenFileName ();
37
std::string flnm = fileName.toStdString();
38
return
TString
(flnm.c_str());
39
}
40
TString
Basic string class.
Definition:
TString.h:129
TString.h