Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

QGo4RootCanvas.cpp

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "QGo4RootCanvas.h"
00017 
00018 #include "Riostream.h"
00019 
00020 #include "TCanvas.h"
00021 
00022 #include "qapplication.h"
00023 #include "qstring.h"
00024 #include "qcursor.h"
00025 #include "qdragobject.h"
00026 
00027 QGo4RootCanvas::QGo4RootCanvas(QWidget *parent, const char *name, TCanvas *c) :
00028    TQRootCanvas(parent, name, c),
00029    fxShowEventStatus(false)
00030 {
00031    setAcceptDrops(true);
00032    setSizeIncrement( QSize( 100, 100 ) );
00033    setBaseSize(QSize(800, 500));
00034    Resize();
00035    Update();
00036 }
00037 
00038 QGo4RootCanvas::~QGo4RootCanvas()
00039 {
00040 }
00041 
00042 void QGo4RootCanvas::setShowEventStatus(bool s)
00043 {
00044    fxShowEventStatus = s;
00045 }
00046 
00047 bool QGo4RootCanvas::showEventStatus() const
00048 {
00049    return fxShowEventStatus;
00050 }
00051 
00052 void QGo4RootCanvas::mouseMoveEvent(QMouseEvent *e)
00053 {
00054    TQRootCanvas::mouseMoveEvent(e);
00055    if(fxShowEventStatus) {
00056       TObject* selected = fCanvas->GetSelected();
00057       Int_t px = fCanvas->GetEventX();
00058       Int_t py = fCanvas->GetEventY();
00059       QString buffer = "";
00060       if (selected!=0) {
00061          buffer = selected->GetName();
00062          buffer += "  ";
00063          buffer += selected->GetObjectInfo(px,py);
00064       } else {
00065          buffer = "No seleceted object x = ";
00066          buffer += QString::number(px);
00067          buffer += "  y = ";
00068          buffer += QString::number(py);
00069       }
00070       emit CanvasStatusEvent(buffer.latin1());
00071    }
00072 }
00073 
00074 void QGo4RootCanvas::dragEnterEvent(QDragEnterEvent* e)
00075 {
00076    if (QTextDrag::canDecode(e))
00077       e->accept();
00078 }
00079 
00080 void QGo4RootCanvas::dropEvent(QDropEvent* event)
00081 {
00082    TObject *object = 0;
00083    QPoint Pos = event->pos();
00084    TPad* pad = Pick(Pos.x(), Pos.y(), object);
00085 
00086    if (pad!=0)
00087      emit CanvasDropEvent(event, pad);
00088 }
00089 
00090 void QGo4RootCanvas::performResize()
00091 {
00092    QApplication::setOverrideCursor(Qt::WaitCursor);
00093    TQRootCanvas::performResize();
00094    emit DoCanvasResize();
00095    QApplication::restoreOverrideCursor();
00096 }
00097 
00098 void QGo4RootCanvas::leaveEvent(QEvent* e)
00099 {
00100    TQRootCanvas::leaveEvent(e);
00101    emit CanvasLeaveEvent();
00102 }
00103 
00104 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:20 2008 for Go4-v3.04-1 by  doxygen 1.4.2