Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RCanvasWidget.cpp
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 13/01/2021
2
3/*************************************************************************
4 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#include "RCanvasWidget.h"
12
13#include <ROOT/RCanvas.hxx>
15
17{
18
19 setObjectName( "RCanvasWidget");
20
21 setSizeIncrement( QSize( 100, 100 ) );
22
23 setUpdatesEnabled( true );
24 setMouseTracking(true);
25
26 setFocusPolicy( Qt::TabFocus );
27 setCursor( Qt::CrossCursor );
28
29 setAcceptDrops(true);
30
32
33 auto where = ROOT::RWebDisplayArgs::GetQt5EmbedQualifier(this, "noopenui", QT_VERSION);
34
35 fCanvas->Show(where);
36
37 fView = findChild<QWebEngineView*>("RootWebView");
38 if (!fView) {
39 printf("FAIL TO FIND QWebEngineView - ROOT Qt5Web plugin does not work properly !!!!!\n");
40 exit(11);
41 }
42
43 fView->resize(width(), height());
44 fCanvas->SetSize(width(), height());
45}
46
48{
49 // remove canvas from global lists
50 fCanvas->Remove();
51}
52
53void RCanvasWidget::resizeEvent(QResizeEvent *event)
54{
55 fView->resize(width(), height());
56 fCanvas->SetSize(width(), height());
57}
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
QWebEngineView * fView
qt webwidget to show
~RCanvasWidget() override
RCanvasWidget(QWidget *parent=nullptr)
void resizeEvent(QResizeEvent *event) override
std::shared_ptr< ROOT::Experimental::RCanvas > fCanvas
static std::shared_ptr< RCanvas > Create(const std::string &title)
Create new canvas instance.
Definition RCanvas.cxx:89
static std::string GetQt5EmbedQualifier(const void *qparent, const std::string &urlopt="", unsigned qtversion=0x50000)
Returns string which can be used as argument in RWebWindow::Show() method to display web window in pr...