Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkLesionTextDialog.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 
13 #include "QmitkLesionTextDialog.h"
14 
15 #include <QLabel>
16 #include <QLayout>
17 #include <qpushbutton.h>
18 
20  : QDialog(parent)
21 {
22  QBoxLayout* verticalLayout = new QVBoxLayout(this);
23  verticalLayout->setMargin(5);
24  verticalLayout->setSpacing(5);
25 
26  QLabel* dialogLabel = new QLabel(tr("Set lesion information"), this);
27  verticalLayout->addWidget(dialogLabel);
28 
29  m_LineEdit = new QLineEdit(this);
30  m_LineEdit->setFocus();
31  verticalLayout->addWidget(m_LineEdit);
32 
33  QPushButton* acceptButton = new QPushButton(tr("Ok"), this);
34  QPushButton* cancelButton = new QPushButton(tr("Cancel"), this);
35  acceptButton->setDefault(true);
36 
37  connect(acceptButton, &QPushButton::clicked, this, &QmitkLesionTextDialog::accept);
38  connect(cancelButton, &QPushButton::clicked, this, &QmitkLesionTextDialog::reject);
39 
40  QBoxLayout* horizontalLayout = new QHBoxLayout();
41  horizontalLayout->setSpacing(5);
42  horizontalLayout->addStretch();
43  horizontalLayout->addWidget(acceptButton);
44  horizontalLayout->addWidget(cancelButton);
45  verticalLayout->addLayout(horizontalLayout);
46 
47  setMinimumSize(250, 100);
48 }
49 
50 void QmitkLesionTextDialog::SetLineEditText(const std::string& lineEditText)
51 {
52  m_LineEdit->setText(QString::fromStdString(lineEditText));
53 }
54 
56 {
57  return m_LineEdit->text();
58 }
59 
61 {
62  return m_LineEdit;
63 }
QmitkLesionTextDialog(QWidget *parent=nullptr)
QLineEdit * GetLineEdit() const
void SetLineEditText(const std::string &lineEditText)