qtrootexample1.ui.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** ui.h extension file, included from the uic-generated form implementation.
00003 **
00004 ** If you wish to add, delete or rename slots use Qt Designer which will
00005 ** update this file, preserving your code. Create an init() slot in place of
00006 ** a constructor, and a destroy() slot in place of a destructor.
00007 *****************************************************************************/
00008 #include "TCanvas.h"
00009 #include "TClass.h"
00010 #include "TFile.h"
00011 
00012 #if QT_VERSION >= 0x40000
00013 //Added by qt3to4:
00014 #include <QPixmap>
00015 #include <QMimeSource>
00016 #include <Q3MimeSourceFactory>
00017 #include <Q3ImageDrag>
00018 #include <Q3ListViewItem>
00019 typedef Q3ListViewItem QListViewItem;
00020 typedef Q3DragObject QDragObject;
00021 typedef Q3TextDrag QTextDrag;
00022 typedef Q3ImageDrag QImageDrag;
00023 typedef Q3MimeSourceFactory QMimeSourceFactory;
00024 #endif
00025 
00026 static QPixmap uic_load_pixmap( const QString &name )
00027 {
00028    const QMimeSource *m = QMimeSourceFactory::defaultFactory()->data( name );
00029    if ( !m )
00030       return QPixmap();
00031    QPixmap pix;
00032    QImageDrag::decode( m, pix );
00033    return pix;
00034 }
00035 
00036 void qtrootexample1::init()
00037 {
00038    TKey *key;
00039    TFile *fxDiskFile;
00040     
00041    (TQRootCanvas1->GetCanvas())->Divide(2,2);
00042    fxDiskFile = new TFile("test.root");
00043    TIter next(fxDiskFile->GetListOfKeys());
00044    while ((key = (TKey*) next())) {
00045       AddItemToListView1(key->ReadObj());
00046    }
00047 }
00048 
00049 void qtrootexample1::destroy()
00050 {
00051 
00052 }
00053 
00054 void qtrootexample1::ListView1_mouseButtonPressed( int, QListViewItem *SelectedItem, const QPoint &, int )
00055 {
00056    if (SelectedItem!=0) {
00057       QDragObject *d = new QTextDrag(SelectedItem->text(0),ListView1);
00058       d->dragCopy();
00059    }
00060 }
00061 
00062 void qtrootexample1::AddItemToListView1(TObject *Key)
00063 {
00064    if( Key->IsA()->InheritsFrom("TH2") ) {
00065       QListViewItem * item1 = new QListViewItem(ListView1, Key->GetName() ,"TH2");
00066       item1->setPixmap( 0, uic_load_pixmap( "h2_t.png" ) );
00067    }
00068    else if (Key->IsA()->InheritsFrom("TH1")) {
00069       QListViewItem * item1 = new QListViewItem(ListView1, Key->GetName(),"TH1");
00070       item1->setPixmap( 0, uic_load_pixmap( "h1_t.png" ) );
00071    }
00072 }
00073 

Generated on Tue Jul 5 14:22:21 2011 for ROOT_528-00b_version by  doxygen 1.5.1