Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TQt6PadPainter.h
Go to the documentation of this file.
1// Author: Sergey Linev, GSI 26/06/2026
2
3/*************************************************************************
4 * Copyright (C) 1995-2026, 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#ifndef ROOT_TQt6PadPainter
12#define ROOT_TQt6PadPainter
13
14#include "TPadPainterBase.h"
15
16#ifdef __CLING__
17class QString;
18class QColor;
19class QPen;
20class QBrush;
21#else
22#include <QString>
23#include <QColor>
24#include <QPen>
25#include <QBrush>
26#endif
27
28class QPaintWidget;
29
30namespace ROOT {
31namespace Experimental {
32
33class TQt6Canvas;
34
36
37friend class TQt6Canvas;
38
39protected:
40
42
43 void PaintQString(int x, int y, const QString &s);
44
45 static QString GetFontFamily(Font_t id);
46 static QColor GetQColor(Color_t id);
49
50public:
51
53
54 Bool_t HasTTFonts() const override { return kTRUE; }
55
56 Bool_t IsNative() const override { return kTRUE; }
57
58
59 void SetOpacity(Int_t percent) override;
60
61 //2. "Off-screen management" part.
62 // return non-zero value to let execute painting code
63 Int_t CreateDrawable(UInt_t, UInt_t) override { return 223344; }
64 void ClearDrawable() override {}
65 void CopyDrawable(Int_t, Int_t, Int_t) override {}
66 void DestroyDrawable(Int_t) override {}
67 void SelectDrawable(Int_t) override {}
68 void SetDoubleBuffer(Int_t /* device */, Int_t /* mode */) override {}
69 void SetCursor(Int_t, ECursor) override;
70
71 //jpg, png, bmp, gif output.
72 void SaveImage(TVirtualPad *, const char *, Int_t) const override;
73
74 //TASImage support (noop for a non-gl pad).
75 void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height,
77
80
82 //TPad needs double and float versions.
83 void DrawFillArea(Int_t n, const Double_t *x, const Double_t *y) override;
84 void DrawFillArea(Int_t n, const Float_t *x, const Float_t *y) override;
85
86 //TPad needs both double and float versions of DrawPolyLine.
87 void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override;
88 void DrawPolyLine(Int_t n, const Float_t *x, const Float_t *y) override;
89 void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override;
90
91 //TPad needs both versions.
92 void DrawPolyMarker(Int_t n, const Double_t *x, const Double_t *y) override;
93 void DrawPolyMarker(Int_t n, const Float_t *x, const Float_t *y) override;
94
95 void DrawText(Double_t x, Double_t y, const char *text, ETextMode mode) override;
96 void DrawText(Double_t x, Double_t y, const wchar_t *text, ETextMode mode) override;
97 void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override;
98 void DrawTextNDC(Double_t u, Double_t v, const wchar_t *text, ETextMode mode) override;
99
100 void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override;
101
102 void GetTextExtent(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const char *mess) override;
103 void GetTextExtent(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const wchar_t *mess) override;
104 void GetTextAscentDescent(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const char *mess) override;
105 void GetTextAscentDescent(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const wchar_t *mess) override;
106 UInt_t GetTextAdvance(Font_t font, Double_t size, const char *text, Bool_t kern) override;
107
108 Bool_t IsSupportAlpha() const override { return kTRUE; }
109
110private:
111 //Let's make this clear:
116
117 ClassDefOverride(TQt6PadPainter, 0) // Pad painter on Qt6 canvas
118};
119
120} // namespace Experimental
121} // namespace ROOT
122
123#endif
ECursor
Definition GuiTypes.h:373
#define d(i)
Definition RSha256.hxx:102
#define a(i)
Definition RSha256.hxx:99
#define h(i)
Definition RSha256.hxx:106
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:78
short Color_t
Color number (short)
Definition RtypesCore.h:100
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
short Font_t
Font number (short)
Definition RtypesCore.h:96
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
#define ClassDefOverride(name, id)
Definition Rtypes.h:347
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t DrawFillArea
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void SetCursor
Option_t Option_t TPoint DrawPolyMarker
Option_t Option_t TPoint TPoint const char DrawLine
Option_t Option_t width
Option_t Option_t TPoint TPoint percent
Option_t Option_t TPoint TPoint DrawText
Option_t Option_t TPoint TPoint SetOpacity
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
Represent area where actual canvas painting is performed.
QBrush GetFillBrush()
Return QBrush for fill drawing drawing.
void SaveImage(TVirtualPad *, const char *, Int_t) const override
Produce image.
Bool_t IsNative() const override
Int_t CreateDrawable(UInt_t, UInt_t) override
void PaintQString(int x, int y, const QString &s)
Actual text painting image.
void DrawTextUrl(Double_t x, Double_t y, const char *text, const char *url) override
Paint text with url.
TQt6PadPainter(const TQt6PadPainter &rhs)=delete
Bool_t HasTTFonts() const override
static QString GetFontFamily(Font_t id)
Return font family for specified ROOT font id If necessary, register TTF font to Qt first.
void SetDoubleBuffer(Int_t, Int_t) override
Set double buffer mode for specified device, redirect to gVirtualX.
void DrawPolyLineNDC(Int_t n, const Double_t *u, const Double_t *v) override
Paint polyline in normalized coordinates.
void GetTextAscentDescent(Font_t font, Double_t size, UInt_t &a, UInt_t &d, const char *mess) override
Returns text accent / descent.
void DrawPixels(const unsigned char *pixelData, UInt_t width, UInt_t height, Int_t dstX, Int_t dstY, Bool_t enableAlphaBlending) override
Noop, for non-gl pad TASImage calls gVirtualX->CopyArea.
void SelectDrawable(Int_t) override
TQt6PadPainter(TQt6PadPainter &&rhs)=delete
TQt6PadPainter(QPaintWidget *widget=nullptr)
Bool_t IsSupportAlpha() const override
static QColor GetQColor(Color_t id)
Return QColor created from specified TColor.
void DrawTextNDC(Double_t u, Double_t v, const char *text, ETextMode mode) override
Paint text in normalized coordinates.
void GetTextExtent(Font_t font, Double_t size, UInt_t &w, UInt_t &h, const char *mess) override
Returns text extent.
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2, EBoxMode mode) override
Paint a simple box.
void DrawPolyLine(Int_t n, const Double_t *x, const Double_t *y) override
Paint Polyline.
void DrawLineNDC(Double_t u1, Double_t v1, Double_t u2, Double_t v2) override
Paint a simple line in normalized coordinates.
void CopyDrawable(Int_t, Int_t, Int_t) override
TQt6PadPainter & operator=(const TQt6PadPainter &rhs)=delete
UInt_t GetTextAdvance(Font_t font, Double_t size, const char *text, Bool_t kern) override
Returns text advance.
void DestroyDrawable(Int_t) override
QPen GetLinePen()
Return QPen for lines drawing.
Extends TVirtualPadPainter interface to simplify work with graphical attributes.
Basic TCanvasImp ABI implementation for Qt6.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Definition TVirtualPad.h:51
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16