19 #include "Riostream.h"
22 #include <QMouseEvent>
23 #include <QCloseEvent>
24 #include <QPaintEvent>
26 #include "TGo4LockGuard.h"
33 TGCompositeFrame(gClient, id, new TGMainFrame(gClient->GetDefaultRoot(),100,100))
65 fbResizeOnPaint(kTRUE),fQtScalingfactor(1.0)
67 setObjectName( name ? name :
"QRootWindow");
70 setUpdatesEnabled(
true );
71 setMouseTracking(
true);
73 setFocusPolicy( Qt::TabFocus );
74 setCursor( Qt::CrossCursor );
83 if ( parent ) parent->installEventFilter(
this );
84 #if QT_VERSION > QT_VERSION_CHECK(5,6,0)
86 fQtScalingfactor=(double) metric(QPaintDevice::PdmDevicePixelRatioScaled)/65536.;
110 if((e==0) || (rev==0))
return kFALSE;
114 rev->fXRoot= e->globalX();
115 rev->fYRoot= e->globalY();
118 if(e->type() == QEvent::MouseButtonPress) rev->fType = kButtonPress;
119 else if(e->type() == QEvent::MouseButtonRelease) rev->fType = kButtonRelease;
120 else if(e->type() == QEvent::MouseButtonDblClick) rev->fType = kButtonDoubleClick;
121 else if(e->type() == QEvent::MouseMove) rev->fType = kMotionNotify;
122 else if(e->type() == QEvent::KeyPress) rev->fType = kGKeyPress;
123 else if(e->type() == QEvent::KeyRelease) rev->fType = kKeyRelease;
124 else rev->fType = kOtherEvent;
128 if(e->buttons() & Qt::LeftButton)
129 rev->fState |= kButton1Mask;
130 if(e->buttons() & Qt::RightButton)
131 rev->fState |= kButton3Mask;
132 if(e->buttons() & Qt::MidButton)
133 rev->fState |= kButton2Mask;
134 if(e->buttons() & Qt::MouseButtonMask)
135 rev->fState |= kButton1Mask;
137 if(e->modifiers() & Qt::ShiftModifier)
138 rev->fState |= kKeyShiftMask;
139 if(e->modifiers() & Qt::ControlModifier)
140 rev->fState |= kKeyControlMask;
141 if(e->modifiers() & Qt::AltModifier)
142 rev->fState |= kKeyMod1Mask;
143 if(e->modifiers() & Qt::MetaModifier)
144 rev->fState |= kKeyMod1Mask;
150 rev->fCode = Qt::NoButton;
151 if(e->button() == Qt::LeftButton)
152 rev->fCode |= kButton1Mask;
153 if(e->button() == Qt::RightButton)
154 rev->fCode |= kButton3Mask;
155 if(e->button() == Qt::MidButton)
156 rev->fCode |= kButton2Mask;
159 rev->fWindow = gVirtualX->GetWindowID(
fiWinid);
177 std::cout <<
"Warning: QRootWindow::paintEvent finds changed X window id: "<< (ULong_t) winId()<<
", previous:"<<
fQtWinId << std::endl;
187 gVirtualX->Update(1);
190 QWidget::paintEvent(e);
196 QMouseEvent* me =
dynamic_cast<QMouseEvent*
>(e);
205 if ( e->type() == QEvent::Close) {
212 return QWidget::eventFilter( o, e );
virtual void CloseWindow()
virtual void closeEvent(QCloseEvent *e)
void AddSubFrame(TGFrame *f, TGLayoutHints *l=0)
void SetEditable(bool on=true)
virtual void paintEvent(QPaintEvent *e)
virtual bool eventFilter(QObject *, QEvent *)
TGCompositeFrame * GetRootFrame()
TQRootFrame * fxRootwindow
QRootWindow(QWidget *parent=0, const char *name=0, bool designermode=false)
Bool_t MapQMouseEvent(QMouseEvent *e, Event_t *rev)