From d56d8d9bd5c4902c6746b9e5efe7376bcbb6992e Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Wed, 1 Jul 2026 14:17:46 +0200 Subject: [PATCH 1/2] [tgaxis] completely remove gVirtualX usage Two methods were used: 1. gVirtualX->SetClipOFF(), which is not necessary while no any places in ROOT where ClipRegion is configured 2. gVirtualX->SetCharacterUp() which was used long time agi to define text rotation angle. It is obsolete while direct text painting with gVirtualX methods no longer usead and textaxis.PaintLatex() always specify angle. This change allows to paint axes and all histograms on qt6 canvas. --- graf2d/graf/src/TGaxis.cxx | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/graf2d/graf/src/TGaxis.cxx b/graf2d/graf/src/TGaxis.cxx index 48a5df2afbb79..13b9bfd3d3fc9 100644 --- a/graf2d/graf/src/TGaxis.cxx +++ b/graf2d/graf/src/TGaxis.cxx @@ -20,7 +20,6 @@ #include "TGaxis.h" #include "TAxisModLab.h" #include "TVirtualPad.h" -#include "TVirtualX.h" #include "TLine.h" #include "TArrow.h" #include "TLatex.h" @@ -1039,7 +1038,6 @@ void TGaxis::PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t yma Double_t ww, af, rne; Double_t xx, yy; Double_t xmnlog, x00, x11, h2, h2sav, axmul, y; - Float_t chupxvsav, chupyvsav; Double_t rtxw, rtyw; Int_t nlabels, nticks, nticks0 = 0, nticks1 = 0; Int_t i, j, k, l, decade; @@ -1370,11 +1368,6 @@ void TGaxis::PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t yma Int_t TitleColor = GetTextColor(); Int_t TitleFont = GetTextFont(); - if (!gPad->IsBatch()) { - gVirtualX->GetCharacterUp(chupxvsav, chupyvsav); - gVirtualX->SetClipOFF(gPad->GetCanvasID()); - } - // Compute length of axis axis_length = TMath::Sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0)); if (axis_length == 0) { @@ -1580,16 +1573,6 @@ void TGaxis::PaintAxis(Double_t xmin, Double_t ymin, Double_t xmax, Double_t yma } } -// Now determine orientation of labels on axis - if (!gPad->IsBatch()) { - if (cosphi > 0) gVirtualX->SetCharacterUp(-sinphi,cosphi); - else gVirtualX->SetCharacterUp(sinphi,-cosphi); - if (x0 == x1) gVirtualX->SetCharacterUp(0,1); - if (optionVert) gVirtualX->SetCharacterUp(0,1); - if (optionPara) gVirtualX->SetCharacterUp(-sinphi,cosphi); - if (optionDown) gVirtualX->SetCharacterUp(cosphi,sinphi); - } - // Now determine text alignment xalign = 2; yalign = 1; From 979e03d0865c70dbb51b689a2c31a3bf5bc6d29e Mon Sep 17 00:00:00 2001 From: Sergey Linev Date: Wed, 1 Jul 2026 14:29:01 +0200 Subject: [PATCH 2/2] [tview3d] remove gVirtualX usage In one place line attributes were reset. Now pad painter is responsible for attributes - use it. Allow to use lego plots with qt6 canvas --- graf3d/g3d/src/TView3D.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/graf3d/g3d/src/TView3D.cxx b/graf3d/g3d/src/TView3D.cxx index 39d7ce675f845..4ca5d562f96ed 100644 --- a/graf3d/g3d/src/TView3D.cxx +++ b/graf3d/g3d/src/TView3D.cxx @@ -12,10 +12,10 @@ #include "RConfigure.h" #include "TVirtualPad.h" +#include "TVirtualPadPainter.h" #include "TView3D.h" #include "TAxis3D.h" #include "TPolyLine3D.h" -#include "TVirtualX.h" #include "TROOT.h" #include "TBuffer.h" #include "TClass.h" @@ -760,10 +760,9 @@ void TView3D::ExecuteRotateView(Int_t event, Int_t px, Int_t py) gPad->SetTheta(90-newlatitude); gPad->Modified(kTRUE); - // Set line color, style and width - gVirtualX->SetLineColor(-1); - gVirtualX->SetLineStyle(-1); - gVirtualX->SetLineWidth(-1); + // reset line color, style and width + if (auto pp = gPad->GetPainter()) + pp->SetAttLine({-1, -1, -1}); break; }