48 #include <QGridLayout>
50 #include <QColorDialog>
52 #include <QPushButton>
67 using namespace DISPLIB;
68 using namespace Eigen;
78 , m_iMaxNumAverages(10)
79 , m_qMapAverageColor(QSharedPointer<QMap<QString, QColor> >::create())
80 , m_qMapAverageActivation(QSharedPointer<QMap<QString, bool> >::create())
83 this->setWindowTitle(
"Average Selection");
84 this->setMinimumWidth(330);
85 this->setMaximumWidth(330);
136 QSettings settings(
"MNECPP");
138 settings.beginGroup(
m_sSettingsPath + QString(
"/AverageSelectionView/averageColorMap"));
141 settings.setValue(iColor.key(), iColor.value());
146 settings.beginGroup(
m_sSettingsPath + QString(
"/AverageSelectionView/averageActivationMap"));
149 settings.setValue(iActivation.key(), iActivation.value());
163 QSettings settings(
"MNECPP");
165 settings.beginGroup(
m_sSettingsPath + QString(
"/AverageSelectionView/averageColorMap"));
166 QStringList keys = settings.childKeys();
167 foreach (QString key, keys) {
172 settings.beginGroup(
m_sSettingsPath + QString(
"/AverageSelectionView/averageActivationMap"));
173 keys = settings.childKeys();
174 foreach (QString key, keys) {
185 case GuiMode::Clinical:
197 case ProcessingMode::Offline:
209 qDebug() <<
"AverageSelectionView::update - m_qMapAverageColor and m_qMapAverageActivation do not match in size. Returning.";
214 QGridLayout* topLayout =
static_cast<QGridLayout*
>(this->layout());
216 topLayout =
new QGridLayout();
220 while ((child = topLayout->takeAt(0)) != 0) {
221 delete child->widget();
228 while(itr.hasNext()) {
229 if(count >= m_iMaxNumAverages) {
236 QPointer<QCheckBox> pCheckBox =
new QCheckBox(itr.key());
238 pCheckBox->setObjectName(itr.key());
239 topLayout->addWidget(pCheckBox, count, 0);
240 connect(pCheckBox.data(), &QCheckBox::clicked,
244 QColor color = itr.value();
245 QPointer<QPushButton> pButton =
new QPushButton(
"Click to change");
246 pButton->setObjectName(itr.key());
247 pButton->setStyleSheet(QString(
"background-color: rgb(%1, %2, %3);").arg(color.red()).arg(color.green()).arg(color.blue()));
248 topLayout->addWidget(pButton, count, 1);
249 connect(pButton.data(), &QPushButton::clicked,
255 this->setLayout(topLayout);
263 if(QPointer<QPushButton> button = qobject_cast<QPushButton*>(sender())) {
264 QString sObjectName = button->objectName();
266 QColor color = QColorDialog::getColor(
m_qMapAverageColor->value(sObjectName),
this,
"Set average color");
269 QPalette palette(QPalette::Button,color);
270 button->setPalette(palette);
274 button->setStyleSheet(QString(
"background-color: rgb(%1, %2, %3);").arg(color.red()).arg(color.green()).arg(color.blue()));
283 if(QPointer<QCheckBox> checkBox = qobject_cast<QCheckBox*>(sender())) {
284 QString sObjectName = checkBox->objectName();