21 #include <itkRGBPixel.h>
23 #include <QAbstractItemModel>
24 #include <QColorDialog>
25 #include <QStringListModel>
28 #include <qlineedit.h>
29 #include <qpushbutton.h>
33 selectedOrgan(tr(
"undefined")),
36 QDialog::setFixedSize(250, 105);
38 QBoxLayout *verticalLayout =
new QVBoxLayout(
this);
39 verticalLayout->setMargin(5);
40 verticalLayout->setSpacing(5);
45 lblPrompt =
new QLabel(tr(
"Name and color of the segmentation"),
this);
49 btnColor =
new QPushButton(
"",
this);
51 btnColor->setAutoFillBackground(
true);
52 btnColor->setStyleSheet(
"background-color:rgb(255,0,0)");
56 edtName =
new QLineEdit(
"",
this);
57 QStringList completionList;
59 completer =
new QCompleter(completionList);
60 completer->setCaseSensitivity(Qt::CaseInsensitive);
65 QBoxLayout *horizontalLayout2 =
new QHBoxLayout();
66 verticalLayout->addLayout(horizontalLayout2);
67 horizontalLayout2->addWidget(
btnColor);
68 horizontalLayout2->addWidget(
edtName);
71 btnOk =
new QPushButton(tr(
"Ok"),
this);
72 btnOk->setDefault(
true);
75 QPushButton *btnCancel =
new QPushButton(tr(
"Cancel"),
this);
76 connect(btnCancel, SIGNAL(clicked()),
this, SLOT(reject()));
78 QBoxLayout *horizontalLayout =
new QHBoxLayout();
79 verticalLayout->addLayout(horizontalLayout);
80 horizontalLayout->setSpacing(5);
81 horizontalLayout->addStretch();
82 horizontalLayout->addWidget(
btnOk);
83 horizontalLayout->addWidget(btnCancel);
110 if (!newText.isEmpty())
112 btnOk->setEnabled(
true);
121 m_Color = QColorDialog::getColor();
129 QString(
"background-color:rgb(%1,%2, %3)").arg(
m_Color.red()).arg(
m_Color.green()).arg(
m_Color.blue()));
148 colorProperty.SetRed(1);
149 colorProperty.SetGreen(0);
150 colorProperty.SetBlue(0);
154 colorProperty.SetRed(
m_Color.redF());
155 colorProperty.SetGreen(
m_Color.greenF());
156 colorProperty.SetBlue(
m_Color.blueF());
158 return colorProperty;
163 QStringList::iterator iter;
164 for (iter = organColorList.begin(); iter != organColorList.end(); ++iter)
166 QString &element = *iter;
167 QString colorName = element.right(7);
168 QColor color(colorName);
169 QString organName = element.left(element.size() - 7);
175 QStringListModel *completeModel =
static_cast<QStringListModel *
>(
completer->model());
183 int j =
organList.indexOf(completedWord);
186 QString(
"background-color:rgb(%1,%2, %3)").arg(
m_Color.red()).arg(
m_Color.green()).arg(
m_Color.blue()));
virtual ~QmitkNewSegmentationDialog()
void setPrompt(const QString &prompt)
QString m_SegmentationName
QList< QColor > colorList
void setSegmentationName(const QString &name)
const QString GetSegmentationName()
void SetSuggestionList(QStringList organColorList)
void onNewOrganNameChanged(const QString &)
void onColorChange(const QString &completedWord)
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
QmitkNewSegmentationDialog(QWidget *parent=nullptr)
const char * GetOrganType()