00001 // @(#)root/qt:$Name: $:$Id: QtFileDialog.C,v 1.5 2008/09/28 02:22:23 fine Exp $ 00002 // Author: Valeri Fine 23/03/2006 00003 #ifndef __CINT__ 00004 # include <QFileDialog> 00005 # include <QString> 00006 # include "TString.h" 00007 # include <string> 00008 #endif 00009 TString QtFileDialog() { 00010 // 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 00011 // See: begin_html <a href="http://doc.trolltech.com/3.3/qfiledialog.html#getOpenFileName">http://doc.trolltech.com/3.3/qfiledialog.html#getOpenFileName</a> end_html 00012 // 00013 // To use, invoke ACLiC from the ROOT prompt: 00014 // root [] .x QtFileDialog.C++ 00015 // 00016 // To use it with no ACLiC, omit the trailing "++" 00017 // root [] .x QtFileDialog.C 00018 // 00019 // The QtFileDialog returns TString object that contains the selected file name. 00020 // returns its pointer. 00021 // The macro QtMultiFileDialog.C provides an advanced example. 00022 // 00023 // The full list of the Qt classes available from Cint is defined by 00024 // begin_html <a href="http://root.bnl.gov/QtRoot/htmldoc/src/qtclasses.h.html">by $ROOTSYS/cint/lib/qtclasses.h</a> end_html 00025 // 00026 // All Qt classes can be used from ACLiC though. 00027 00028 #ifdef __CINT__ 00029 // Load the qt cint dictionary. 00030 // One is recommended to do that at once somewhere. 00031 // For example from his/her custom rootlogon.C script 00032 gSystem->Load("$ROOTSYS/cint/cint/include/qtcint"); 00033 #endif 00034 QString fileName = QFileDialog::getOpenFileName (); 00035 std::string flnm = fileName.toStdString(); 00036 return TString(flnm.c_str()); 00037 } 00038