forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQtFileDialog.C
More file actions
40 lines (36 loc) · 1.19 KB
/
QtFileDialog.C
File metadata and controls
40 lines (36 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/// \file
/// \ingroup tutorial_gui
/// This is a small ROOT macro to use Qt 3.3 class: [QFileDialog](https://doc.qt.io/archives/3.3/qfiledialog.html)
/// See: [https://doc.qt.io/archives/3.3/qfiledialog.html#getOpenFileName](https://doc.qt.io/archives/3.3/qfiledialog.html#getOpenFileName)
///
/// To use, invoke ACLiC from the ROOT prompt:
/// ~~~
/// root [] .x QtFileDialog.C++
/// ~~~
///
/// To use it with no ACLiC, omit the trailing "++"
/// ~~~
/// root [] .x QtFileDialog.C
/// ~~~
///
/// The QtFileDialog returns TString object that contains the selected file name.
/// returns its pointer.
/// The macro QtMultiFileDialog.C provides an advanced example.
///
/// The full list of the Qt classes available from Cint is defined by
/// begin_html [by $ROOTSYS/cint/lib/qtclasses.h](http://root.bnl.gov/QtRoot/htmldoc/src/qtclasses.h.html)
///
/// All Qt classes can be used from ACLiC though.
///
/// \macro_code
///
/// \author Valeri Fine 23/03/2006
# include <QFileDialog>
# include <QString>
# include "TString.h"
# include <string>
TString QtFileDialog() {
QString fileName = QFileDialog::getOpenFileName ();
std::string flnm = fileName.toStdString();
return TString(flnm.c_str());
}