Medical Imaging Interaction Toolkit  2018.4.99-1bab67a2
Medical Imaging Interaction Toolkit
QmitkControlPointDialog.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
15 #include <QAbstractItemModel>
16 #include <QStringListModel>
17 #include <QLabel>
18 #include <QLayout>
19 #include <qpushbutton.h>
20 
22  : QDialog(parent)
23 {
24  QBoxLayout* verticalLayout = new QVBoxLayout(this);
25  verticalLayout->setMargin(5);
26  verticalLayout->setSpacing(5);
27 
28  QLabel* dateLabel = new QLabel(tr("Set date"), this);
29  verticalLayout->addWidget(dateLabel);
30 
31  m_DateEdit = new QDateEdit(this);
32  m_DateEdit->setDisplayFormat("yyyy-MM-dd");
33  m_DateEdit->setFocus();
34  verticalLayout->addWidget(m_DateEdit);
35 
36  QPushButton* acceptButton = new QPushButton(tr("Ok"), this);
37  QPushButton* cancelButton = new QPushButton(tr("Cancel"), this);
38  acceptButton->setDefault(true);
39 
40  connect(acceptButton, &QPushButton::clicked, this, &QmitkControlPointDialog::accept);
41  connect(cancelButton, &QPushButton::clicked, this, &QmitkControlPointDialog::reject);
42 
43  QBoxLayout* horizontalLayout = new QHBoxLayout();
44  horizontalLayout->setSpacing(5);
45  horizontalLayout->addStretch();
46  horizontalLayout->addWidget(acceptButton);
47  horizontalLayout->addWidget(cancelButton);
48  verticalLayout->addLayout(horizontalLayout);
49 
50  setMinimumSize(250, 100);
51 }
52 
54 {
55  m_DateEdit->setDate(QDate(currentControlPoint.date.year(), currentControlPoint.date.month(), currentControlPoint.date.day()));
56 }
57 
59 {
60  return m_DateEdit->date();
61 }
void SetCurrentDate(mitk::SemanticTypes::ControlPoint currentControlPoint)
QmitkControlPointDialog(QWidget *parent=nullptr)