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

#include <G4UIQt.hh>

+ Inheritance diagram for G4QTabWidget:

Public Member Functions

 G4QTabWidget ()
 
 G4QTabWidget (QWidget *aParent, G4int sizeX, G4int sizeY)
 
void paintEvent (QPaintEvent *event) override
 
void setTabSelected (G4bool a)
 
void setLastTabCreated (G4int a)
 
bool isTabSelected ()
 
void setPreferredSize (QSize s)
 
QSize sizeHint () const override
 

Public Attributes

G4bool fTabSelected
 
G4int fLastCreated
 
G4int fPreferedSizeX
 
G4int fPreferedSizeY
 

Detailed Description

Definition at line 82 of file G4UIQt.hh.

Constructor & Destructor Documentation

◆ G4QTabWidget() [1/2]

G4QTabWidget::G4QTabWidget ( )

Definition at line 5419 of file G4UIQt.cc.

5420 : QTabWidget(), fTabSelected(false), fLastCreated(-1), fPreferedSizeX(0), fPreferedSizeY(0)
5421{}
G4int fLastCreated
Definition G4UIQt.hh:92
G4int fPreferedSizeX
Definition G4UIQt.hh:93
G4int fPreferedSizeY
Definition G4UIQt.hh:94
G4bool fTabSelected
Definition G4UIQt.hh:91

◆ G4QTabWidget() [2/2]

G4QTabWidget::G4QTabWidget ( QWidget * aParent,
G4int sizeX,
G4int sizeY )

Definition at line 5406 of file G4UIQt.cc.

5407 : QTabWidget(aParent),
5408 fTabSelected(false),
5409 fLastCreated(-1),
5410 fPreferedSizeX(sizeX + 6) // margin left+right
5411 ,
5412 fPreferedSizeY(sizeY + 58) // tab label height + margin left+right
5413{
5414 setMinimumSize(100, 100);
5415 QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
5416 setSizePolicy(policy);
5417}

Member Function Documentation

◆ isTabSelected()

bool G4QTabWidget::isTabSelected ( )
inline

Definition at line 90 of file G4UIQt.hh.

90{ return fTabSelected; };

Referenced by paintEvent().

◆ paintEvent()

void G4QTabWidget::paintEvent ( QPaintEvent * event)
override

Definition at line 5470 of file G4UIQt.cc.

5471{
5472 if (currentWidget() != nullptr) {
5473 if (isTabSelected()) {
5474 // QCoreApplication::sendPostedEvents () ;
5475
5476 QString text = tabText(currentIndex());
5477
5478 if (fLastCreated == -1) {
5479 auto edit = dynamic_cast<QTextEdit*>(currentWidget());
5480 if (edit == nullptr) {
5481 QString paramSelect = QString("/vis/viewer/select ") + text;
5483 if (UI != nullptr) {
5484 UI->ApplyCommand(paramSelect.toStdString().c_str());
5485 }
5486 }
5487 }
5488 else {
5489 fLastCreated = -1;
5490 }
5491 setTabSelected(false);
5492 }
5493 }
5494}
void setTabSelected(G4bool a)
Definition G4UIQt.hh:88
bool isTabSelected()
Definition G4UIQt.hh:90
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()

◆ setLastTabCreated()

void G4QTabWidget::setLastTabCreated ( G4int a)
inline

Definition at line 89 of file G4UIQt.hh.

89{ fLastCreated = a; };

Referenced by G4UIQt::AddTabWidget().

◆ setPreferredSize()

void G4QTabWidget::setPreferredSize ( QSize s)
inline

Definition at line 95 of file G4UIQt.hh.

96 {
97 fPreferedSizeX = s.width() + 6; // tab label height + margin left+right
98 fPreferedSizeY = s.height() + 58; // margin left+right
99 }

◆ setTabSelected()

void G4QTabWidget::setTabSelected ( G4bool a)
inline

Definition at line 88 of file G4UIQt.hh.

88{ fTabSelected = a; };

Referenced by paintEvent().

◆ sizeHint()

QSize G4QTabWidget::sizeHint ( ) const
inlineoverride

Definition at line 100 of file G4UIQt.hh.

100{ return QSize(fPreferedSizeX, fPreferedSizeY); }

Member Data Documentation

◆ fLastCreated

G4int G4QTabWidget::fLastCreated

Definition at line 92 of file G4UIQt.hh.

Referenced by paintEvent(), and setLastTabCreated().

◆ fPreferedSizeX

G4int G4QTabWidget::fPreferedSizeX

Definition at line 93 of file G4UIQt.hh.

Referenced by setPreferredSize(), and sizeHint().

◆ fPreferedSizeY

G4int G4QTabWidget::fPreferedSizeY

Definition at line 94 of file G4UIQt.hh.

Referenced by setPreferredSize(), and sizeHint().

◆ fTabSelected

G4bool G4QTabWidget::fTabSelected

Definition at line 91 of file G4UIQt.hh.

Referenced by isTabSelected(), and setTabSelected().


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