Geant4 11.3.0
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 83 of file G4UIQt.hh.

Constructor & Destructor Documentation

◆ G4QTabWidget() [1/2]

G4QTabWidget::G4QTabWidget ( )

Definition at line 5458 of file G4UIQt.cc.

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

◆ G4QTabWidget() [2/2]

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

Definition at line 5445 of file G4UIQt.cc.

5446 : QTabWidget(aParent),
5447 fTabSelected(false),
5448 fLastCreated(-1),
5449 fPreferedSizeX(sizeX + 6) // margin left+right
5450 ,
5451 fPreferedSizeY(sizeY + 58) // tab label height + margin left+right
5452{
5453 setMinimumSize(100, 100);
5454 QSizePolicy policy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
5455 setSizePolicy(policy);
5456}

Member Function Documentation

◆ isTabSelected()

bool G4QTabWidget::isTabSelected ( )
inline

Definition at line 91 of file G4UIQt.hh.

91{ return fTabSelected; };

Referenced by paintEvent().

◆ paintEvent()

void G4QTabWidget::paintEvent ( QPaintEvent * event)
override

Definition at line 5536 of file G4UIQt.cc.

5537{
5538 if (currentWidget() != nullptr) {
5539 if (isTabSelected()) {
5540 // QCoreApplication::sendPostedEvents () ;
5541
5542 QString text = tabText(currentIndex());
5543
5544 if (fLastCreated == -1) {
5545 auto edit = dynamic_cast<QTextEdit*>(currentWidget());
5546 if (edit == nullptr) {
5547 QString paramSelect = QString("/vis/viewer/select ") + text;
5548 G4UImanager* UI = G4UImanager::GetUIpointer();
5549 if (UI != nullptr) {
5550 UI->ApplyCommand(paramSelect.toStdString().c_str());
5551 }
5552 }
5553 }
5554 else {
5555 fLastCreated = -1;
5556 }
5557 setTabSelected(false);
5558 }
5559 }
5560}
void setTabSelected(G4bool a)
Definition G4UIQt.hh:89
bool isTabSelected()
Definition G4UIQt.hh:91
G4int ApplyCommand(const char *aCommand)
static G4UImanager * GetUIpointer()

◆ setLastTabCreated()

void G4QTabWidget::setLastTabCreated ( G4int a)
inline

Definition at line 90 of file G4UIQt.hh.

90{ fLastCreated = a; };

◆ setPreferredSize()

void G4QTabWidget::setPreferredSize ( QSize s)
inline

Definition at line 96 of file G4UIQt.hh.

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

◆ setTabSelected()

void G4QTabWidget::setTabSelected ( G4bool a)
inline

Definition at line 89 of file G4UIQt.hh.

89{ fTabSelected = a; };

Referenced by paintEvent().

◆ sizeHint()

QSize G4QTabWidget::sizeHint ( ) const
inlineoverride

Definition at line 101 of file G4UIQt.hh.

101{ return QSize(fPreferedSizeX, fPreferedSizeY); }

Member Data Documentation

◆ fLastCreated

G4int G4QTabWidget::fLastCreated

Definition at line 93 of file G4UIQt.hh.

Referenced by G4QTabWidget(), G4QTabWidget(), paintEvent(), and setLastTabCreated().

◆ fPreferedSizeX

G4int G4QTabWidget::fPreferedSizeX

Definition at line 94 of file G4UIQt.hh.

Referenced by G4QTabWidget(), G4QTabWidget(), setPreferredSize(), and sizeHint().

◆ fPreferedSizeY

G4int G4QTabWidget::fPreferedSizeY

Definition at line 95 of file G4UIQt.hh.

Referenced by G4QTabWidget(), G4QTabWidget(), setPreferredSize(), and sizeHint().

◆ fTabSelected

G4bool G4QTabWidget::fTabSelected

Definition at line 92 of file G4UIQt.hh.

Referenced by G4QTabWidget(), G4QTabWidget(), isTabSelected(), and setTabSelected().


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