Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TQt6Application.cxx
Go to the documentation of this file.
1// Author: Sergey Linev 30/07/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#include "TQt6Application.h"
12
13#include "TError.h"
14#include "TTimer.h"
15#include "TApplication.h"
16
17#include <QApplication>
18
19using namespace ROOT::Experimental;
20
21class TQt6EventsTimer : public TTimer {
22public:
25
26 /// used to send control messages to clients
27 void Timeout() override
28 {
29 QApplication::sendPostedEvents();
30 QApplication::processEvents();
31 }
32};
33
34
35/** \class TQt6Application
36 \ingroup qt6canvas
37
38Provides Qt6-specific methods for TApplication.
39Main purpose - runs Qt event loop
40*/
41
42
43////////////////////////////////////////////////////////////////////////////////
44/// Create Qt6 application environment.
45
46TQt6Application::TQt6Application(const char *appClassName,
48{
50}
51
52////////////////////////////////////////////////////////////////////////////////
53/// Delete Qt6 application environment.
54
58
59
60////////////////////////////////////////////////////////////////////////////////
61/// Create QApplication and timer to handle Qt events
62
64{
65 static QApplication *qapp = nullptr;
66 static int qargc = 1;
67 static char *qargv[2];
68
69 if (!qapp && !QApplication::instance()) {
70
71 if (argv)
72 qargv[0] = argv[0];
73 else if (gApplication)
74 qargv[0] = gApplication->Argv(0);
75 else {
76 ::Error("TQt6Application::CreateQApplication", "Not found gApplication to create QApplication");
77 return;
78 }
79 qargv[1] = nullptr;
80
82 }
83
84 static TQt6EventsTimer *timer = nullptr;
85
86 if (!timer) {
87 timer = new TQt6EventsTimer(10, kTRUE);
88 timer->TurnOn();
89 }
90
91}
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:69
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
R__EXTERN TApplication * gApplication
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
Option_t Option_t TPoint TPoint const char mode
static void CreateQApplication(int argc=0, char **argv=nullptr)
Create QApplication and timer to handle Qt events.
~TQt6Application() override
Delete Qt6 application environment.
ABC describing GUI independent application implementation protocol.
char ** Argv() const
void Timeout() override
used to send control messages to clients
TQt6EventsTimer(Long_t milliSec, Bool_t mode)
Handles synchronous and a-synchronous timer events.
Definition TTimer.h:51
Namespace for ROOT features in testing.
Definition TROOT.h:100