Skip to content

[qt6canv] provide Qt6 application with use of TQt6Canvas - #24105

Draft
linev wants to merge 8 commits into
root-project:masterfrom
linev:canvas_demos
Draft

linev wants to merge 8 commits into
root-project:masterfrom
linev:canvas_demos

Conversation

@linev

@linev linev commented Nov 11, 2026

Copy link
Copy Markdown
Member

Provide demo application which embed TQt6Canvas and shows how it can be used with plain Qt6 code.

PR include also changes in base ROOT classes required to correctly initialize such embed canvas.
Therefore it much more than creating demo - it next step to remove hard dependency from TVirtualX code in TCanvas.

Very important changes - new TCanvasImp::IsUseVirtualX() method.
It will be used to isolate all TVirtualX-specific code in TCanvas classes.
Only classical canvas implementation will be allowed to re-paint its content outside of Update() method.
There are not much such places - but all need to be identified and handled.

Also try to address graphics initialization. TCanvas normally loads gVirtualX-related libraries automatically.
But now for embed canvases one tries to avoid this. Later one can try same for normal TCanvas as well.

Work in progress ...

@linev linev self-assigned this Nov 11, 2026
@linev
linev requested a review from bellenot as a code owner November 11, 2026 15:42
@linev linev added the skip ci Skip the full builds on the actions runners label Nov 11, 2026
@linev
linev marked this pull request as draft November 11, 2026 15:42
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 4c1e97e.

♻️ This comment has been updated with latest results.

TCanvasImp indicates if gVirtualX methods are involved by the canvas and
correspondent libraries need to be initialized.

Also use of gVirtualX allows to perform canvas clear or border painting
outside of Update() method.

Flag is TRUE by default in ROOT6 but will be switched to FALSE in ROOT7.
For TRootCanvas it returns kTRUE, for all others kFALSE
When new implementation assigned to the canvas,
call Init() and Build() methods when gVirtualX is not used.

It provides "legal" way to prepare TCanvas data after it created with
`new TCanvas(kFALSE)` constructor. Such canvas is dummy and many fields
are not properly initialized. When external TCanvasImp implementation
assigned to the canvas now it will be initilized as any other normal canvas
- bit only if IsUseVirtualX() returns false.

Also during such initialization graphics libs for gVirtualX will not be loaded.
It dedicated for exteranl usage of TQt6Canvas in existing Qt6 applications.
Idea to have simple method to create ROOT TCanvas object for exisitng QWidget
and initialize all necessary ROOT classes for that.
@linev
linev force-pushed the canvas_demos branch 2 times, most recently from ff9976e to 50d94d4 Compare November 13, 2026 13:21
Correctly use canvas status bits, remove inherit code from TWebCanvas
Provide Close and Show methods which will call correspondent Qt6 methods
Shows drawing of different ROOT classes plus live update
Plus demo how show/hide menu, toolbar, events status on such embed canvas

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:Graphics skip ci Skip the full builds on the actions runners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant