ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #ifndef __CINT__
30 # include <QFileDialog>
31 # include <QString>
32 # include "TString.h"
33 # include <string>
34 #endif
35 
36 TString QtFileDialog() {
37 #ifdef __CINT__
38  // Load the qt cint dictionary.
39  // One is recommended to do that at once somewhere.
40  // For example from one's custom rootlogon.C script
41  gSystem->Load("$ROOTSYS/cint/cint/include/qtcint");
42 #endif
43  QString fileName = QFileDialog::getOpenFileName ();
44  std::string flnm = fileName.toStdString();
45  return TString(flnm.c_str());
46 }
47 
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Definition: TSystem.cxx:1766
Basic string class.
Definition: TString.h:137
R__EXTERN TSystem * gSystem
Definition: TSystem.h:545