19 #include "TVirtualX.h"
21 #include <QMouseEvent>
22 #include <QCloseEvent>
25 #include "TGo4LockGuard.h"
27 #define TGo4LockGuard int
35 TGCompositeFrame(gClient, id, new TGMainFrame(gClient->GetDefaultRoot(),100,100))
67 fbResizeOnPaint(kTRUE),fQtScalingfactor(1.0)
69 setObjectName( name ? name :
"QRootWindow");
72 setUpdatesEnabled(
true );
73 setMouseTracking(
true);
75 setFocusPolicy( Qt::TabFocus );
76 setCursor( Qt::CrossCursor );
85 if ( parent ) parent->installEventFilter(
this );
86 #if QT_VERSION > QT_VERSION_CHECK(5,6,0)
88 fQtScalingfactor=(double) metric(QPaintDevice::PdmDevicePixelRatioScaled)/65536.;
112 if(!e || !rev)
return kFALSE;
114 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
117 rev->fXRoot = e->globalX();
118 rev->fYRoot = e->globalY();
120 rev->fX = e->position().x();
121 rev->fY = e->position().y();
122 rev->fXRoot = e->globalPosition().x();
123 rev->fYRoot = e->globalPosition().y();
127 if(e->type() == QEvent::MouseButtonPress) rev->fType = kButtonPress;
128 else if(e->type() == QEvent::MouseButtonRelease) rev->fType = kButtonRelease;
129 else if(e->type() == QEvent::MouseButtonDblClick) rev->fType = kButtonDoubleClick;
130 else if(e->type() == QEvent::MouseMove) rev->fType = kMotionNotify;
131 else if(e->type() == QEvent::KeyPress) rev->fType = kGKeyPress;
132 else if(e->type() == QEvent::KeyRelease) rev->fType = kKeyRelease;
133 else rev->fType = kOtherEvent;
137 if(e->buttons() & Qt::LeftButton)
138 rev->fState |= kButton1Mask;
139 if(e->buttons() & Qt::RightButton)
140 rev->fState |= kButton3Mask;
141 if(e->buttons() & Qt::MiddleButton)
142 rev->fState |= kButton2Mask;
143 if(e->buttons() & Qt::MouseButtonMask)
144 rev->fState |= kButton1Mask;
146 if(e->modifiers() & Qt::ShiftModifier)
147 rev->fState |= kKeyShiftMask;
148 if(e->modifiers() & Qt::ControlModifier)
149 rev->fState |= kKeyControlMask;
150 if(e->modifiers() & Qt::AltModifier)
151 rev->fState |= kKeyMod1Mask;
152 if(e->modifiers() & Qt::MetaModifier)
153 rev->fState |= kKeyMod1Mask;
159 rev->fCode = Qt::NoButton;
160 if(e->button() == Qt::LeftButton)
161 rev->fCode |= kButton1Mask;
162 if(e->button() == Qt::RightButton)
163 rev->fCode |= kButton3Mask;
164 if(e->button() == Qt::MiddleButton)
165 rev->fCode |= kButton2Mask;
168 rev->fWindow = gVirtualX->GetWindowID(
fiWinid);
188 std::cout <<
"Warning: QRootWindow::paintEvent finds changed X window id: "<< (ULong_t) winId()<<
", previous:"<<
fQtWinId << std::endl;
199 gVirtualX->Update(1);
202 QWidget::paintEvent(e);
210 QMouseEvent* me =
dynamic_cast<QMouseEvent*
>(e);
219 if ( e->type() == QEvent::Close) {
226 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)