Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4RTQtScanner Class Reference

#include <G4RTQtScanner.hh>

Inheritance diagram for G4RTQtScanner:

Public Member Functions

 G4RTQtScanner ()
virtual ~G4RTQtScanner ()
virtual void Initialize (G4int nRow, G4int nColumn)
virtual G4bool Coords (G4int &iRow, G4int &iColumn)
virtual void Draw (unsigned char red, unsigned char green, unsigned char blue)
G4bool GetQtWindow (const G4String &name, G4ViewParameters &)
Public Member Functions inherited from G4VRTScanner
 G4VRTScanner ()
virtual ~G4VRTScanner ()

Protected Attributes

G4int theNRow
G4int theNColumn
G4int theIRow
G4int theIColumn
G4int theWindowSizeX
G4int theWindowSizeY
QLabel * fpImageLabel
QImage * fpImage

Detailed Description

Definition at line 47 of file G4RTQtScanner.hh.

Constructor & Destructor Documentation

◆ G4RTQtScanner()

G4RTQtScanner::G4RTQtScanner ( )

Definition at line 45 of file G4RTQtScanner.cc.

47, theNRow(0), theNColumn(0)
48, theIRow(0), theIColumn(0)
49, fpImageLabel(nullptr)
50, fpImage(nullptr)
51{}
QLabel * fpImageLabel

◆ ~G4RTQtScanner()

G4RTQtScanner::~G4RTQtScanner ( )
virtual

Definition at line 53 of file G4RTQtScanner.cc.

53{}

Member Function Documentation

◆ Coords()

G4bool G4RTQtScanner::Coords ( G4int & iRow,
G4int & iColumn )
virtual

Implements G4VRTScanner.

Definition at line 62 of file G4RTQtScanner.cc.

63{
64 // Increment column and, if necessary, increment row...
65 ++theIColumn;
66 if (theIColumn >= theNColumn) {
67 theIColumn = 0;
68 ++theIRow;
69 }
70
71 // Return if finished...
72 if (theIRow >= theNRow) {
73 // ...and paint the image
74 fpImageLabel->setPixmap(QPixmap::fromImage(*fpImage));
75 QPainter windowPainter(fpImageLabel);
76 windowPainter.drawImage(0, 0, *fpImage);
77 return false;
78 }
79
80 // Return current row and column...
81 iRow = theIRow;
82 iColumn = theIColumn;
83 return true;
84}

◆ Draw()

void G4RTQtScanner::Draw ( unsigned char red,
unsigned char green,
unsigned char blue )
virtual

Reimplemented from G4VRTScanner.

Definition at line 110 of file G4RTQtScanner.cc.

113{
114 QPainter painter(fpImage);
115 painter.setPen(QPen(QColor(int(red), int(green), int(blue))));
116 painter.drawPoint(theIColumn, theIRow);
117}

◆ GetQtWindow()

G4bool G4RTQtScanner::GetQtWindow ( const G4String & name,
G4ViewParameters & vp )

Definition at line 86 of file G4RTQtScanner.cc.

87{
88 auto UI = G4UImanager::GetUIpointer();
89 auto uiQt = dynamic_cast<G4UIQt*>(UI->GetG4UIWindow());
90 if (!uiQt) {
91 G4warn << "G4RTQtScanner::GetQtWindow: RayTracerQt requires G4UIQt"
92 << G4endl;
93 return false;
94 }
95 uiQt->AddTabWidget(this,QString(name));
96 setBackgroundRole(QPalette::Dark);
97
98 theWindowSizeX = vp.GetWindowSizeHintX(); // As used by the ray tracer
99 theWindowSizeY = vp.GetWindowSizeHintY(); // and to make fpImage
100 fpImage = new QImage(theWindowSizeX, theWindowSizeY, QImage::Format_RGB32);
101 fpImageLabel = new QLabel;
102 fpImageLabel->setPixmap(QPixmap::fromImage(*fpImage));
103 setWidget(fpImageLabel);
104 setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
105 ensureVisible(theWindowSizeX/2, theWindowSizeY/2);
106
107 return true;
108}
#define G4warn
Definition G4Scene.cc:41
#define G4endl
Definition G4ios.hh:67
static G4UImanager * GetUIpointer()
unsigned int GetWindowSizeHintX() const
unsigned int GetWindowSizeHintY() const

Referenced by G4RayTracerQtViewer::Initialise().

◆ Initialize()

void G4RTQtScanner::Initialize ( G4int nRow,
G4int nColumn )
virtual

Implements G4VRTScanner.

Definition at line 55 of file G4RTQtScanner.cc.

55 {
56 theNRow = nRow;
57 theNColumn = nColumn;
58 theIRow = 0;
59 theIColumn = -1;
60}

Member Data Documentation

◆ fpImage

QImage* G4RTQtScanner::fpImage
protected

Definition at line 75 of file G4RTQtScanner.hh.

Referenced by Coords(), Draw(), G4RTQtScanner(), and GetQtWindow().

◆ fpImageLabel

QLabel* G4RTQtScanner::fpImageLabel
protected

Definition at line 74 of file G4RTQtScanner.hh.

Referenced by Coords(), G4RTQtScanner(), and GetQtWindow().

◆ theIColumn

G4int G4RTQtScanner::theIColumn
protected

Definition at line 72 of file G4RTQtScanner.hh.

Referenced by Coords(), Draw(), G4RTQtScanner(), and Initialize().

◆ theIRow

G4int G4RTQtScanner::theIRow
protected

Definition at line 72 of file G4RTQtScanner.hh.

Referenced by Coords(), Draw(), G4RTQtScanner(), and Initialize().

◆ theNColumn

G4int G4RTQtScanner::theNColumn
protected

Definition at line 72 of file G4RTQtScanner.hh.

Referenced by Coords(), G4RTQtScanner(), and Initialize().

◆ theNRow

G4int G4RTQtScanner::theNRow
protected

Definition at line 72 of file G4RTQtScanner.hh.

Referenced by Coords(), G4RTQtScanner(), and Initialize().

◆ theWindowSizeX

G4int G4RTQtScanner::theWindowSizeX
protected

Definition at line 73 of file G4RTQtScanner.hh.

Referenced by GetQtWindow().

◆ theWindowSizeY

G4int G4RTQtScanner::theWindowSizeY
protected

Definition at line 73 of file G4RTQtScanner.hh.

Referenced by GetQtWindow().


The documentation for this class was generated from the following files: