ATLAS Offline Software
Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
VP1AODSelection Class Reference

#include <VP1AODSelection.h>

Inheritance diagram for VP1AODSelection:
Collaboration diagram for VP1AODSelection:

Public Member Functions

 VP1AODSelection (QWidget *parent=0)
 

Private Slots

void on_browseButton_clicked ()
 
void loadDatabase ()
 

Private Member Functions

void animateFindClick ()
 
QComboBox * createComboBox (const QString &text=QString())
 

Private Attributes

QString m_fileName
 
QComboBox * m_directoryComboBox
 
QPushButton * m_browseButton
 
QPushButton * m_openButton
 
QPushButton * m_cancelButton
 
QDialogButtonBox * m_buttonBox
 

Detailed Description

Definition at line 24 of file VP1AODSelection.h.

Constructor & Destructor Documentation

◆ VP1AODSelection()

VP1AODSelection::VP1AODSelection ( QWidget *  parent = 0)
explicit

Definition at line 34 of file VP1AODSelection.cxx.

34  : QDialog(parent)
35 {
36  //Set default dialog size
37  int nWidth = 800;
38  int nHeight = 220;
39  if (parent != NULL)
40  setGeometry(parent->x() + parent->width()/2 - nWidth/2,
41  parent->y() + parent->height()/2 - nHeight/2,
42  nWidth, nHeight);
43  else
44  resize(nWidth, nHeight);
45 
46  //Browse button to select database
47  m_browseButton = new QPushButton(tr("&Browse..."), this);
48  connect(m_browseButton, &QAbstractButton::clicked, this, &VP1AODSelection::on_browseButton_clicked);
49 
50  //Buttonbox to set Open, Cancel buttons
51  m_buttonBox = new QDialogButtonBox(this);
52  m_openButton = m_buttonBox->addButton(tr("&Open"), QDialogButtonBox::AcceptRole);
53  m_cancelButton = m_buttonBox->addButton(tr("&Cancel"),QDialogButtonBox::RejectRole);
54  connect(m_openButton, &QPushButton::clicked, this, &VP1AODSelection::loadDatabase);
55  connect(m_cancelButton, &QPushButton::clicked, this, &VP1AODSelection::reject);
56 
57  //Open QSettings to store path do database
58  QSettings settings("ATLAS", "VP1Light");
59  QString text;
60 
61  //If no xAOD file has been provided via command line argument, the "xaod/path" value is ""
62  if(settings.value("aod/path").toString()==""){
63  m_openButton->setEnabled(false);
64  text = "(*)";
65  } else { //If a xAOD file has been provided show it in the combobox
66  text = settings.value("aod/path").toString();
67  }
68  //Create the combobox
70 
71  //Create the main layout
72  QGridLayout *mainLayout = new QGridLayout(this);
73  mainLayout->addWidget(new QLabel(tr("Select AOD file:")), 0, 0);
74  mainLayout->addWidget(m_directoryComboBox, 1, 0, 1, 2);
75  mainLayout->addWidget(m_browseButton, 1, 4);
76  mainLayout->addWidget(m_buttonBox, 3, 4);
77 
78  m_browseButton->setMinimumWidth(200);
79  m_buttonBox->setMinimumWidth(200);
80  m_browseButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
81  m_buttonBox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
82 }

Member Function Documentation

◆ animateFindClick()

void VP1AODSelection::animateFindClick ( )
private

Definition at line 96 of file VP1AODSelection.cxx.

97 {
98  m_openButton->animateClick();
99 }

◆ createComboBox()

QComboBox * VP1AODSelection::createComboBox ( const QString &  text = QString())
private

Definition at line 85 of file VP1AODSelection.cxx.

86 {
87  QComboBox *comboBox = new QComboBox;
88  comboBox->setMinimumWidth(600);
89  comboBox->setEditable(false);
90  comboBox->addItem(text);
91  comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
92  return comboBox;
93 }

◆ loadDatabase

void VP1AODSelection::loadDatabase ( )
privateslot

Definition at line 121 of file VP1AODSelection.cxx.

121  {
122 
123  //Save xAOD path to settings
124  QSettings settings("ATLAS", "VP1Light");
125  settings.setValue("aod/path", m_directoryComboBox->itemText(m_directoryComboBox->currentIndex()));
126 
127  //If the selected xAOD does not exists, go back
128  if (!QFileInfo::exists(m_directoryComboBox->itemText(m_directoryComboBox->currentIndex()))){
129  QMessageBox msgBox;
130  msgBox.setWindowTitle("Virtual Point 1");
131  msgBox.setText("AOD file does not exist. Please choose another file.");
132  msgBox.exec();
133  return;
134  }
135  VP1AODSelection::setResult(1);
137 }

◆ on_browseButton_clicked

void VP1AODSelection::on_browseButton_clicked ( )
privateslot

Definition at line 102 of file VP1AODSelection.cxx.

103 {
104  m_fileName = QFileDialog::getOpenFileName(this,
105  tr("Select AOD file"), QDir::currentPath(),
106  tr("AOD Files (*)"));
107 
108  // Add the selected file to the combobox
109  if (!m_fileName.isEmpty()) {
110  if (m_directoryComboBox->findText(m_fileName) == -1)
112  m_directoryComboBox->setCurrentIndex(m_directoryComboBox->findText(m_fileName));
113 
114  //When valid a database is selected, enable the Open button to confirm
115  m_openButton->setEnabled(true);
116  }
117 
118 }

Member Data Documentation

◆ m_browseButton

QPushButton* VP1AODSelection::m_browseButton
private

Definition at line 42 of file VP1AODSelection.h.

◆ m_buttonBox

QDialogButtonBox* VP1AODSelection::m_buttonBox
private

Definition at line 45 of file VP1AODSelection.h.

◆ m_cancelButton

QPushButton* VP1AODSelection::m_cancelButton
private

Definition at line 44 of file VP1AODSelection.h.

◆ m_directoryComboBox

QComboBox* VP1AODSelection::m_directoryComboBox
private

Definition at line 41 of file VP1AODSelection.h.

◆ m_fileName

QString VP1AODSelection::m_fileName
private

Definition at line 40 of file VP1AODSelection.h.

◆ m_openButton

QPushButton* VP1AODSelection::m_openButton
private

Definition at line 43 of file VP1AODSelection.h.


The documentation for this class was generated from the following files:
VP1AODSelection::on_browseButton_clicked
void on_browseButton_clicked()
Definition: VP1AODSelection.cxx:102
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
VP1AODSelection::m_cancelButton
QPushButton * m_cancelButton
Definition: VP1AODSelection.h:44
VP1AODSelection::m_browseButton
QPushButton * m_browseButton
Definition: VP1AODSelection.h:42
VP1AODSelection::m_buttonBox
QDialogButtonBox * m_buttonBox
Definition: VP1AODSelection.h:45
VP1AODSelection::m_directoryComboBox
QComboBox * m_directoryComboBox
Definition: VP1AODSelection.h:41
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1AODSelection::m_fileName
QString m_fileName
Definition: VP1AODSelection.h:40
VP1AODSelection::loadDatabase
void loadDatabase()
Definition: VP1AODSelection.cxx:121
makeTransCanvas.text
text
Definition: makeTransCanvas.py:11
python.dummyaccess.exists
def exists(filename)
Definition: dummyaccess.py:9
VP1AODSelection::createComboBox
QComboBox * createComboBox(const QString &text=QString())
Definition: VP1AODSelection.cxx:85
VP1AODSelection::m_openButton
QPushButton * m_openButton
Definition: VP1AODSelection.h:43