ATLAS Offline Software
Loading...
Searching...
No Matches
VP1SelectEvent Class Reference

#include <VP1SelectEvent.h>

Inheritance diagram for VP1SelectEvent:
Collaboration diagram for VP1SelectEvent:

Public Member Functions

 VP1SelectEvent (int totEvtNr, int evtNr, QWidget *parent=0)

Private Member Functions

void passEvtNr ()
void reject ()

Private Attributes

QPushButton * m_cancelButton
QPushButton * m_openButton
QDialogButtonBox * m_buttonBox
QSpinBox * m_spinBox

Detailed Description

Definition at line 24 of file VP1SelectEvent.h.

Constructor & Destructor Documentation

◆ VP1SelectEvent()

VP1SelectEvent::VP1SelectEvent ( int totEvtNr,
int evtNr,
QWidget * parent = 0 )
explicit

Definition at line 32 of file VP1SelectEvent.cxx.

32 : QDialog(parent)
33{
34 //Set default dialog size
35 int nWidth = 400;
36 int nHeight = 200;
37 if (parent != NULL)
38 setGeometry(parent->x() + parent->width()/2 - nWidth/2,
39 parent->y() + parent->height()/2 - nHeight/2,
40 nWidth, nHeight);
41 else
42 resize(nWidth, nHeight);
43
44 //Buttonbox to set Open, Cancel buttons
45 m_buttonBox = new QDialogButtonBox(this);
46 m_openButton = m_buttonBox->addButton(tr("&Select"), QDialogButtonBox::AcceptRole);
47 m_cancelButton = m_buttonBox->addButton(tr("&Cancel"),QDialogButtonBox::RejectRole);
48 connect(m_openButton, &QPushButton::clicked, this, &VP1SelectEvent::passEvtNr);
49 connect(m_cancelButton, &QPushButton::clicked, this, &VP1SelectEvent::reject);
50
51
52 m_spinBox = new QSpinBox();
53 m_spinBox->setRange(1, totEvtNr);
54 m_spinBox->setSingleStep(1);
55 m_spinBox->setValue(evtNr+1);
56
57 const QString line2 = QString::number(totEvtNr) + " events in file.";
58
59 //Create the main layout
60 QGridLayout *mainLayout = new QGridLayout(this);
61 mainLayout->addWidget(new QLabel(tr("Select event:")), 0, 0);
62 mainLayout->addWidget(m_spinBox, 0, 1);
63 mainLayout->addWidget(new QLabel(line2), 1, 0);
64 mainLayout->addWidget(m_buttonBox, 2, 1);
65
66}
QPushButton * m_openButton
QDialogButtonBox * m_buttonBox
QPushButton * m_cancelButton
QSpinBox * m_spinBox

Member Function Documentation

◆ passEvtNr()

void VP1SelectEvent::passEvtNr ( )
private

Definition at line 68 of file VP1SelectEvent.cxx.

68 {
69 if( m_spinBox->value() != 0 ) {
70 VP1SelectEvent::done(m_spinBox->value());
71 }
72}

◆ reject()

void VP1SelectEvent::reject ( )
private

Definition at line 74 of file VP1SelectEvent.cxx.

74 {
75 VP1SelectEvent::done(-1);
76}

Member Data Documentation

◆ m_buttonBox

QDialogButtonBox* VP1SelectEvent::m_buttonBox
private

Definition at line 38 of file VP1SelectEvent.h.

◆ m_cancelButton

QPushButton* VP1SelectEvent::m_cancelButton
private

Definition at line 36 of file VP1SelectEvent.h.

◆ m_openButton

QPushButton* VP1SelectEvent::m_openButton
private

Definition at line 37 of file VP1SelectEvent.h.

◆ m_spinBox

QSpinBox* VP1SelectEvent::m_spinBox
private

Definition at line 39 of file VP1SelectEvent.h.


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