Repository navigation
Introduce Qt6-based implementation for TCanvasImp
#22736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
53e3ba5
[qt6canv] introduce qt6canv build option to ROOT
linev 97ecaf9
[qt6canv] add TQt6Canvas and TQt6PadPainter classes
linev 4f230fe
[qt6canv] add plugin fot TQt6Canvas
linev 0ad09ae
[qt6canv] introduce QCanvasWidget
linev db48d81
[qt6canv] instroduce special widget for paint area
linev f82881a
[qt6canv] introduce QPaintWidget
linev 99480fc
[qt6canv] use paintEvent for canvas paint
linev 7428fef
[qt6canv] implement text metrics with QFont
linev 558fc75
[qt6canv] implement lines and polylines drawing
linev 18cfa90
[qt6canv] implement fill styles
linev bca6427
[qt6canv] simple marker painting
linev 2712746
[qt6canv] use scaling factor for the QFont size
linev 9b26716
[qt6canv] correctly convert const char * to QString
linev 3057fc4
[qt6canv] provide mouse events handling
linev 1570b0a
[qt6canv] provide cursors and window title and size
linev c2ecc9f
[qt6canv] introduce TQt6GuiFactory
linev 9dfe218
[qt6canv] introduce QRootContextMenu
linev d2995d4
[qt6canv] use list of TContextMenuItem from TClass
linev 6c2e5f6
[qt6canv] implement arguments dialog for context menu
linev 7d5a229
[qt6canv] implement File menu commands
linev a15645f
[qt6canv] add View menu items
linev 0ffff3a
[qt6canv] implement most buttons in toolbar
linev e6fc2de
[qt6canv] provide basic attributes editors
linev 4d63bdb
[qt6canv] add enter/leave/wheel handlers
linev 816a872
[qt6canv] provide more documentation
linev 38edab6
[qt6canv] introduce specialized TApplicationImp class
linev df6388b
[qt6canvas] move QApplication initialization to TQt6Application class
linev 93c95b5
[qt6canvas] return false in TQt6GuiFactory::UseVirtualX()
linev 9d38d41
[qt6canvas] implement markers painting
linev a7fecce
[qt6canvas] add several checks and missing includes
linev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,7 @@ opengl=ON | |
| pyroot=ON | ||
| pythia8=OFF | ||
| qt6web=OFF | ||
| qt6canv=OFF | ||
| roofit=ON | ||
| roofit_multiprocess=OFF | ||
| root7=ON | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| void P020_TQt6Canvas() | ||
| { | ||
| gPluginMgr->AddHandler("TCanvasImp", "TQt6Canvas", "ROOT::Experimental::TQt6Canvas", | ||
| "ROOTQt6Canvas", "NewCanvas(TCanvas *, const char *, Int_t, Int_t, UInt_t, UInt_t)"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| void P020_TQt6GuiFactory() | ||
| { | ||
| gPluginMgr->AddHandler("TGuiFactory", "qt6", "ROOT::Experimental::TQt6GuiFactory", | ||
| "ROOTQt6Canvas", "TQt6GuiFactory()"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. | ||
| # All rights reserved. | ||
| # | ||
| # For the licensing terms see $ROOTSYS/LICENSE. | ||
| # For the list of contributors see $ROOTSYS/README/CREDITS. | ||
|
|
||
| ############################################################################ | ||
| # CMakeLists.txt file for building ROOT gui/qt6canvas package | ||
| ############################################################################ | ||
|
|
||
| find_package(Qt6 COMPONENTS Core Widgets CONFIG) | ||
|
|
||
| if(NOT Qt6_FOUND) | ||
| if(fail-on-missing) | ||
| message(FATAL_ERROR "Could NOT find Qt6 with Gui components") | ||
| else() | ||
| message(WARNING "Qt6 (Gui) not found, disabling option 'qt6canvas'") | ||
| set(qt6canv OFF CACHE BOOL "Disabled because Qt6 Gui not found" FORCE) | ||
| return() | ||
| endif() | ||
| endif() | ||
|
|
||
|
|
||
| set(CMAKE_AUTOMOC ON) | ||
| set(CMAKE_AUTORCC ON) | ||
| set(CMAKE_AUTOUIC ON) | ||
| set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
|
||
| ROOT_STANDARD_LIBRARY_PACKAGE(ROOTQt6Canvas | ||
| HEADERS | ||
| TQt6Application.h | ||
| TQt6Canvas.h | ||
| TQt6PadPainter.h | ||
| TQt6GuiFactory.h | ||
| SOURCES | ||
| src/QCanvasWidget.cpp | ||
| src/QPaintWidget.cpp | ||
| src/QRootMethodDialog.cpp | ||
| src/QRootContextMenu.cpp | ||
| src/TQt6Application.cxx | ||
| src/TQt6Canvas.cxx | ||
| src/TQt6PadPainter.cxx | ||
| src/TQt6GuiFactory.cxx | ||
| LIBRARIES | ||
| Qt6::Core | ||
| Qt6::Widgets | ||
| DEPENDENCIES | ||
| Core | ||
| Gpad | ||
| ) | ||
|
|
||
| target_include_directories(ROOTQt6Canvas PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Author: Sergey Linev, GSI 26/06/2026 | ||
|
|
||
| /************************************************************************* | ||
| * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. * | ||
| * All rights reserved. * | ||
| * * | ||
| * For the licensing terms see $ROOTSYS/LICENSE. * | ||
| * For the list of contributors see $ROOTSYS/README/CREDITS. * | ||
| *************************************************************************/ | ||
|
|
||
| #ifdef __CLING__ | ||
|
|
||
| #pragma link off all globals; | ||
| #pragma link off all classes; | ||
| #pragma link off all functions; | ||
|
linev marked this conversation as resolved.
|
||
|
|
||
| #pragma link C++ class ROOT::Experimental::TQt6Canvas+; | ||
| #pragma link C++ class ROOT::Experimental::TQt6PadPainter+; | ||
| #pragma link C++ class ROOT::Experimental::TQt6GuiFactory+; | ||
| #pragma link C++ class ROOT::Experimental::TQt6Application+; | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| // Author: Sergey Linev 30/07/2026 | ||
|
|
||
| /************************************************************************* | ||
| * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. * | ||
| * All rights reserved. * | ||
| * * | ||
| * For the licensing terms see $ROOTSYS/LICENSE. * | ||
| * For the list of contributors see $ROOTSYS/README/CREDITS. * | ||
| *************************************************************************/ | ||
|
|
||
|
|
||
| #ifndef ROOT_TQt6Application | ||
| #define ROOT_TQt6Application | ||
|
|
||
|
|
||
| #include "TApplicationImp.h" | ||
|
|
||
| namespace ROOT { | ||
| namespace Experimental { | ||
|
|
||
| class TQt6Application : public TApplicationImp { | ||
| public: | ||
| TQt6Application() = delete; | ||
| TQt6Application(const char *appClassName, Int_t *argc, char **argv); | ||
| ~TQt6Application() override; | ||
|
|
||
| void Show() override {} | ||
| void Hide() override {} | ||
| void Iconify() override {} | ||
| Bool_t IsCmdThread() override { return kTRUE; } | ||
| void Init() override {} | ||
| void Open() override {} | ||
| void Raise() override {} | ||
| void Lower() override {} | ||
|
|
||
| static void CreateQApplication(int argc = 0, char **argv = nullptr); | ||
|
|
||
| ClassDefOverride(TQt6Application,0) // ROOT Qt6 GUI application environment | ||
| }; | ||
|
|
||
| } // namespace Experimental | ||
| } // namespace ROOT | ||
|
|
||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Author: Sergey Linev, GSI 26/06/2026 | ||
|
|
||
| /************************************************************************* | ||
| * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. * | ||
| * All rights reserved. * | ||
| * * | ||
| * For the licensing terms see $ROOTSYS/LICENSE. * | ||
| * For the list of contributors see $ROOTSYS/README/CREDITS. * | ||
| *************************************************************************/ | ||
|
|
||
| #ifndef ROOT_TQt6Canvas | ||
| #define ROOT_TQt6Canvas | ||
|
|
||
| #include "TCanvasImp.h" | ||
|
|
||
| class QWidget; | ||
| class QCanvasWidget; | ||
| class QPaintWidget; | ||
|
|
||
| namespace ROOT { | ||
| namespace Experimental { | ||
|
|
||
|
|
||
| class TQt6Canvas : public TCanvasImp { | ||
|
|
||
| protected: | ||
|
|
||
| QCanvasWidget *fCanvasWidget = nullptr; | ||
| QPaintWidget *fPaintWidget = nullptr; | ||
|
|
||
| Bool_t fFixedSize = kFALSE; ///<! true when fixed-size canvas is configured | ||
| UInt_t fClientBits = 0; ///<! latest status bits from client like editor visible or not | ||
|
|
||
| Bool_t PerformUpdate(Bool_t async) override; | ||
| TVirtualPadPainter *CreatePadPainter() override; | ||
|
|
||
| void AssignStatusBits(UInt_t bits); | ||
|
|
||
|
|
||
| public: | ||
| TQt6Canvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height); | ||
| ~TQt6Canvas() override; | ||
|
|
||
| QPaintWidget *GetPaintWidget() const { return fPaintWidget; } | ||
|
|
||
| Int_t InitWindow() override; | ||
| void Close() override; | ||
| void Show() override; | ||
|
|
||
| UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override; | ||
| void GetCanvasGeometry(Int_t wid, UInt_t &w, UInt_t &h) override; | ||
| void ResizeCanvasWindow(Int_t) override {} | ||
| void UpdateDisplay(Int_t = 0, Bool_t = kFALSE) override {} | ||
|
|
||
| void ShowMenuBar(Bool_t = kTRUE) override { } | ||
| void ShowStatusBar(Bool_t = kTRUE) override { } | ||
| void ShowEditor(Bool_t = kTRUE) override { } | ||
| void ShowToolBar(Bool_t = kTRUE) override { } | ||
| void ShowToolTips(Bool_t = kTRUE) override { } | ||
|
|
||
| void ForceUpdate() override; | ||
|
|
||
| void SetWindowPosition(Int_t x, Int_t y) override; | ||
| void SetWindowSize(UInt_t w, UInt_t h) override; | ||
| void SetWindowTitle(const char *newTitle) override; | ||
| void SetCanvasSize(UInt_t w, UInt_t h) override; | ||
| void Iconify() override; | ||
| void RaiseWindow() override; | ||
|
|
||
| Bool_t HasEditor() const override; | ||
| Bool_t HasMenuBar() const override; | ||
| Bool_t HasStatusBar() const override; | ||
| Bool_t HasToolBar() const override { return kFALSE; } | ||
| Bool_t HasToolTips() const override; | ||
|
|
||
| static TCanvasImp *NewCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height); | ||
|
|
||
| ClassDefOverride(TQt6Canvas, 0) // Qt6 implementation for TCanvasImp | ||
| }; | ||
|
|
||
| } // namespace Experimental | ||
| } // namespace ROOT | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Author: Sergey Linev 2/07/2026 | ||
|
|
||
| /************************************************************************* | ||
| * Copyright (C) 1995-2026, Rene Brun and Fons Rademakers. * | ||
| * All rights reserved. * | ||
| * * | ||
| * For the licensing terms see $ROOTSYS/LICENSE. * | ||
| * For the list of contributors see $ROOTSYS/README/CREDITS. * | ||
| *************************************************************************/ | ||
|
|
||
|
|
||
| #ifndef ROOT_TQt6GuiFactory | ||
| #define ROOT_TQt6GuiFactory | ||
|
|
||
|
|
||
| #include "TGuiFactory.h" | ||
|
|
||
| namespace ROOT { | ||
| namespace Experimental { | ||
|
|
||
| class TQt6GuiFactory : public TGuiFactory { | ||
|
|
||
| public: | ||
| TQt6GuiFactory(const char *name = "RootQt6", const char *title = "ROOT Qt6 GUI Factory"); | ||
| ~TQt6GuiFactory() override {} | ||
|
|
||
| Bool_t UseVirtualX() const override { return kFALSE; } | ||
|
|
||
| TApplicationImp *CreateApplicationImp(const char *classname, int *argc, char **argv) override; | ||
|
|
||
| TCanvasImp *CreateCanvasImp(TCanvas *c, const char *title, UInt_t width, UInt_t height) override; | ||
| TCanvasImp *CreateCanvasImp(TCanvas *c, const char *title, Int_t x, Int_t y, UInt_t width, UInt_t height) override; | ||
|
|
||
| TContextMenuImp *CreateContextMenuImp(TContextMenu *c, const char *name, const char *title) override; | ||
|
|
||
| ClassDefOverride(TQt6GuiFactory,0) //Factory for Qt6 GUI components | ||
| }; | ||
|
|
||
| } // namespace Experimental | ||
| } // namespace ROOT | ||
|
|
||
|
|
||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.