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();