Example #1
0
/* --------------------------------------------------------------------------
 * createColorChooser
 *
 * Creates a simple widget for choosing an RGB color value.
 * -------------------------------------------------------------------------- */
void ObjectPanel::createColorChooser()
{
    QLabel   *labelR   = new QLabel( tr( "Red" ) );
    QLabel   *labelG   = new QLabel( tr( "Green" ) );
    QLabel   *labelB   = new QLabel( tr( "Blue" ) );
    QSpinBox *spinBoxR = new QSpinBox;
    QSpinBox *spinBoxG = new QSpinBox;
    QSpinBox *spinBoxB = new QSpinBox;
    m_pSliderR         = new QSlider( Qt::Horizontal );
    m_pSliderG         = new QSlider( Qt::Horizontal );
    m_pSliderB         = new QSlider( Qt::Horizontal );


    labelR->setFixedWidth( 40 );
    labelG->setFixedWidth( 40 );
    labelB->setFixedWidth( 40 );
    spinBoxR->setRange( 0, 255 );
    spinBoxG->setRange( 0, 255 );
    spinBoxB->setRange( 0, 255 );
    m_pSliderR->setRange( 0, 255 );
    m_pSliderG->setRange( 0, 255 );
    m_pSliderB->setRange( 0, 255 );

    /* Connect status changes of spinboxes to corresponding
     * sliders and vice versa. */
    connect( spinBoxR, SIGNAL( valueChanged( int ) ),
             m_pSliderR, SLOT( setValue( int ) ) );
    connect( m_pSliderR, SIGNAL( valueChanged( int ) ),
             spinBoxR, SLOT( setValue( int ) ) );

    connect( spinBoxG, SIGNAL( valueChanged( int ) ),
             m_pSliderG, SLOT( setValue( int ) ) );
    connect( m_pSliderG, SIGNAL( valueChanged( int ) ),
             spinBoxG, SLOT( setValue( int ) ) );

    connect( spinBoxB, SIGNAL( valueChanged( int ) ),
             m_pSliderB, SLOT( setValue( int ) ) );
    connect( m_pSliderB, SIGNAL( valueChanged( int ) ),
             spinBoxB, SLOT( setValue( int ) ) );

    /* Connect the color change signal sent by Renderer. (to this) */
    connect( m_pRenderer, SIGNAL( objectRGB( int, int, int ) ),
             this, SLOT( setRGBValues( int, int, int ) ) );

    /* Connect the color change signal sent by this. (to the renderer) */
    connect( this, SIGNAL( colorChanged( int, int, int) ),
             m_pRenderer, SLOT( changeObjectColor( int, int, int ) ) );

    /* Call sendRGBValues() if any of the sliders change state. */
    connect( m_pSliderR, SIGNAL( valueChanged( int ) ),
             this, SLOT( sendRGBValues() ) );
    connect( m_pSliderG, SIGNAL( valueChanged( int ) ),
             this, SLOT( sendRGBValues() ) );
    connect( m_pSliderB, SIGNAL( valueChanged( int ) ),
             this, SLOT( sendRGBValues() ) );

    spinBoxR->setValue( 0 );
    spinBoxG->setValue( 0 );
    spinBoxB->setValue( 0 );

    /* Create layout for the widget. */
    QHBoxLayout *layoutR = new QHBoxLayout;
    QHBoxLayout *layoutG = new QHBoxLayout;
    QHBoxLayout *layoutB = new QHBoxLayout;
    layoutR->addWidget( labelR );
    layoutR->addWidget( m_pSliderR );
    layoutR->addWidget( spinBoxR );
    layoutG->addWidget( labelG );
    layoutG->addWidget( m_pSliderG );
    layoutG->addWidget( spinBoxG );
    layoutB->addWidget( labelB );
    layoutB->addWidget( m_pSliderB );
    layoutB->addWidget( spinBoxB );
    QVBoxLayout *layout = new QVBoxLayout;
    layout->addLayout( layoutR );
    layout->addLayout( layoutG );
    layout->addLayout( layoutB );

    setLayout( layout );
}
Example #2
0
void TruckBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const {
    int         value = index.model()->data(index, Qt::EditRole).toInt();

    QSpinBox    *spinBox = dynamic_cast<QSpinBox *>(editor);
    spinBox->setValue(value);
}
Example #3
0
    void AbstractFilter::createWidget()
    {
      QRadioButton * inclusiveButton = new QRadioButton("Inclusive");
      inclusiveButton->setFont(*smallFont);
      QRadioButton * exclusiveButton = new QRadioButton("Exclusive");
      exclusiveButton->setFont(*smallFont);

      inclusiveExclusiveGroup = new QButtonGroup;
      connect(inclusiveExclusiveGroup, SIGNAL(buttonClicked(int)),
          this, SIGNAL(filterChanged()));
      inclusiveExclusiveGroup->addButton(inclusiveButton, 0);
      inclusiveExclusiveGroup->addButton(exclusiveButton, 1);

      inclusiveExclusiveLayout = new QHBoxLayout;
      QMargins margins = inclusiveExclusiveLayout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      inclusiveExclusiveLayout->setContentsMargins(margins);
      inclusiveExclusiveLayout->addWidget(inclusiveButton);
      inclusiveExclusiveLayout->addWidget(exclusiveButton);

      QHBoxLayout * controlsLayout = new QHBoxLayout;
      margins = controlsLayout->contentsMargins();
      margins.setTop(0);
      margins.setBottom(0);
      controlsLayout->setContentsMargins(margins);

      controlsLayout->addLayout(inclusiveExclusiveLayout);

      effectivenessGroup = new QButtonGroup();
      effectivenessGroup->setExclusive(false);

      if (effectivenessFlags->testFlag(Images))
        effectivenessGroup->addButton(
            createEffectivenessCheckBox("&Images"), 0);

      if (effectivenessFlags->testFlag(Points))
        effectivenessGroup->addButton(
            createEffectivenessCheckBox("&Points"), 1);

      if (effectivenessFlags->testFlag(Measures))
        effectivenessGroup->addButton(
            createEffectivenessCheckBox("&Measures"), 2);

      QString firstGroupEntry;
      ASSERT(effectivenessGroup->buttons().size());
      if (effectivenessGroup->buttons().size())
      {
        firstGroupEntry = effectivenessGroup->buttons()[0]->text();
        firstGroupEntry.remove(0, 1);
      }

      QList<QAbstractButton *> buttons = effectivenessGroup->buttons();
      if (effectivenessGroup->buttons().size() >= 2)
      {
        QHBoxLayout * effectivenessLayout = new QHBoxLayout;
        QMargins effectivenessMargins = effectivenessLayout->contentsMargins();
        effectivenessMargins.setTop(0);
        effectivenessMargins.setBottom(0);
        effectivenessLayout->setContentsMargins(effectivenessMargins);

        for (int i = 0; i < buttons.size(); i++)
          effectivenessLayout->addWidget(buttons[i]);

        controlsLayout->addLayout(effectivenessLayout);
      }
      else
      {
        for (int i = 0; i < buttons.size(); i++)
          delete buttons[i];
        delete effectivenessGroup;
        effectivenessGroup = NULL;
      }

      if (minForSuccess != -1)
      {
        QLabel * label = new QLabel;
        label->setText(
            "<span>Min Count<br/>for " + firstGroupEntry + "</span>");
        label->setFont(QFont("SansSerif", 7));
        QSpinBox * spinBox = new QSpinBox;
        spinBox->setRange(1, std::numeric_limits< int >::max());
        spinBox->setValue(1);  // FIXME: QSettings should handle this
        connect(spinBox, SIGNAL(valueChanged(int)),
            this, SLOT(updateMinForSuccess(int)));
        QHBoxLayout * minLayout = new QHBoxLayout;
        margins = minLayout->contentsMargins();
        margins.setTop(0);
        margins.setBottom(0);
        minLayout->setContentsMargins(margins);
        minLayout->addWidget(label);
        minLayout->addWidget(spinBox);
        minWidget = new QWidget;
        minWidget->setLayout(minLayout);

        controlsLayout->addWidget(minWidget);
        controlsLayout->setAlignment(minWidget, Qt::AlignTop);
        minWidget->setVisible(true); // FIXME: QSettings should handle this
      }
// Reading ad writing parameters from/to selected widget to/from parameters container
void SynchronizeInterfaceWindow(QWidget *window, cParameterContainer *par, enumReadWrite mode)
{
	WriteLog("cInterface::SynchronizeInterface: QLineEdit", 3);
	//----------- QLineEdit -------------------
	{
		QList<QLineEdit *> widgetListLineEdit = window->findChildren<QLineEdit *>();
		QList<QLineEdit *>::iterator it;

		for (it = widgetListLineEdit.begin(); it != widgetListLineEdit.end(); ++it)
		{
			// qDebug() << "QLineEdit:" << (*it)->objectName() << " Type:" <<
			// (*it)->metaObject()->className() << endl;

			QString name = (*it)->objectName();
			QString className = (*it)->metaObject()->className();
			if (name.length() > 1
					&& (className == QString("QLineEdit") || className == QString("MyLineEdit")))
			{
				QLineEdit *lineEdit = *it;
				// QString text = lineEdit->text();
				// qDebug() << name << " - text: " << text << endl;

				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);
				// qDebug() << name << " - type: " << type << endl;

				if (className == QString("MyLineEdit"))
				{
					MyLineEdit *mylineedit = (MyLineEdit *)*it;
					mylineedit->AssignParameterContainer(par);
					mylineedit->AssignParameterName(parameterName);
				}

				//----- get vectors ------------
				if (type == QString("vect3") || type == QString("logvect3"))
				{
					char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
					QString nameVect = parameterName.left(parameterName.length() - 2);

					if (mode == read)
					{
						double value = systemData.locale.toDouble(lineEdit->text());
						// qDebug() << nameVect << " - " << lastChar << " axis = " << value << endl;
						CVector3 vect = par->Get<CVector3>(nameVect);

						switch (lastChar)
						{
							case 'x': vect.x = value; break;

							case 'y': vect.y = value; break;

							case 'z': vect.z = value; break;

							default:
								qWarning() << "cInterface::SynchronizeInterfaceWindow(): edit field " << nameVect
													 << " has wrong axis name (is " << lastChar << ")" << endl;
								break;
						}
						par->Set(nameVect, vect);
					}
					else if (mode == write)
					{
						CVector3 vect = par->Get<CVector3>(nameVect);
						QString qtext;

						switch (lastChar)
						{
							case 'x': qtext = QString("%L1").arg(vect.x, 0, 'g', 16); break;

							case 'y': qtext = QString("%L1").arg(vect.y, 0, 'g', 16); break;

							case 'z': qtext = QString("%L1").arg(vect.z, 0, 'g', 16); break;

							default:
								qWarning() << "cInterface::SynchronizeInterfaceWindow(): edit field " << nameVect
													 << " has wrong axis name (is " << lastChar << ")" << endl;
								break;
						}
						lineEdit->setText(qtext);
						lineEdit->setCursorPosition(0);
					}
				}

				//----- get vectors 4D  ------------
				if (type == QString("vect4"))
				{
					char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
					QString nameVect = parameterName.left(parameterName.length() - 2);

					if (mode == read)
					{
						double value = systemData.locale.toDouble(lineEdit->text());
						// qDebug() << nameVect << " - " << lastChar << " axis = " << value << endl;
						CVector4 vect = par->Get<CVector4>(nameVect);

						switch (lastChar)
						{
							case 'x': vect.x = value; break;

							case 'y': vect.y = value; break;

							case 'z': vect.z = value; break;

							case 'w': vect.w = value; break;

							default:
								qWarning() << "cInterface::SynchronizeInterfaceWindow(): edit field " << nameVect
													 << " has wrong axis name (is " << lastChar << ")" << endl;
								break;
						}
						par->Set(nameVect, vect);
					}
					else if (mode == write)
					{
						CVector4 vect = par->Get<CVector4>(nameVect);
						QString qtext;

						switch (lastChar)
						{
							case 'x': qtext = QString("%L1").arg(vect.x, 0, 'g', 16); break;

							case 'y': qtext = QString("%L1").arg(vect.y, 0, 'g', 16); break;

							case 'z': qtext = QString("%L1").arg(vect.z, 0, 'g', 16); break;

							case 'w': qtext = QString("%L1").arg(vect.w, 0, 'g', 16); break;

							default:
								qWarning() << "cInterface::SynchronizeInterfaceWindow(): edit field " << nameVect
													 << " has wrong axis name (is " << lastChar << ")" << endl;
								break;
						}
						lineEdit->setText(qtext);
						lineEdit->setCursorPosition(0);
					}
				}

				//---------- get double scalars --------
				else if (type == QString("edit") || type == QString("logedit"))
				{
					if (mode == read)
					{
						double value = systemData.locale.toDouble(lineEdit->text());
						par->Set(parameterName, value);
					}
					else if (mode == write)
					{
						double value = par->Get<double>(parameterName);
						lineEdit->setText(QString("%L1").arg(value, 0, 'g', 16));
						lineEdit->setCursorPosition(0);
					}
				}

				//----------- get texts ------------
				else if (type == QString("text"))
				{
					if (mode == read)
					{
						QString value = lineEdit->text();
						par->Set(parameterName, value);
					}
					else if (mode == write)
					{
						QString value = par->Get<QString>(parameterName);
						lineEdit->setText(value);
					}
				}
			}
		} // end foreach
	}

	WriteLog("cInterface::SynchronizeInterface: QDoubleSpinBox", 3);
	//------------ Double spin-box --------------
	{
		QList<QDoubleSpinBox *> widgetListDoubleSpinBox = window->findChildren<QDoubleSpinBox *>();
		QList<QDoubleSpinBox *>::iterator it;
		for (it = widgetListDoubleSpinBox.begin(); it != widgetListDoubleSpinBox.end(); ++it)
		{
			QString name = (*it)->objectName();
			// qDebug() << "QDoubleSpinBox:" << (*it)->objectName() << " Type:" <<
			// (*it)->metaObject()->className() << endl;
			QString className = (*it)->metaObject()->className();
			if (name.length() > 1
					&& (className == QString("QDoubleSpinBox") || className == QString("MyDoubleSpinBox")))
			{
				QDoubleSpinBox *spinbox = *it;

				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				if (className == QString("MyDoubleSpinBox"))
				{
					MyDoubleSpinBox *mydoublespinbox = (MyDoubleSpinBox *)*it;
					mydoublespinbox->AssignParameterContainer(par);
					mydoublespinbox->AssignParameterName(parameterName);
				}

				if (type == QString("spinbox") || type == QString("spinboxd"))
				{
					if (mode == read)
					{
						double value = spinbox->value();
						par->Set(parameterName, value);
					}
					else if (mode == write)
					{
						double value = par->Get<double>(parameterName);
						spinbox->setValue(value);
					}
				}
				else if (type == QString("spinbox3") || type == QString("spinboxd3"))
				{
					char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
					QString nameVect = parameterName.left(parameterName.length() - 2);
					if (mode == read)
					{
						double value = spinbox->value();
						CVector3 vect = par->Get<CVector3>(nameVect);

						switch (lastChar)
						{
							case 'x': vect.x = value; break;

							case 'y': vect.y = value; break;

							case 'z': vect.z = value; break;

							default:
								qWarning() << "cInterface::SynchronizeInterfaceWindow(): " << type << " "
													 << nameVect << " has wrong axis name (is " << lastChar << ")" << endl;
								break;
						}
						par->Set(nameVect, vect);
					}
					else if (mode == write)
					{
						CVector3 vect = par->Get<CVector3>(nameVect);
						double value = 0;

						switch (lastChar)
						{
							case 'x': value = vect.x; break;

							case 'y': value = vect.y; break;

							case 'z': value = vect.z; break;

							default:
								qWarning() << "cInterface::SynchronizeInterfaceWindow(): " << type << " "
													 << nameVect << " has wrong axis name (is " << lastChar << ")" << endl;
								break;
						}
						spinbox->setValue(value);
					}
				}
				else if (type == QString("spinbox4") || type == QString("spinboxd4"))
				{
					char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
					QString nameVect = parameterName.left(parameterName.length() - 2);
					if (mode == read)
					{
						double value = spinbox->value();
						CVector4 vect = par->Get<CVector4>(nameVect);

						switch (lastChar)
						{
							case 'x': vect.x = value; break;

							case 'y': vect.y = value; break;

							case 'z': vect.z = value; break;

							case 'w': vect.w = value; break;

							default:
								qWarning() << "cInterface::SynchronizeInterfaceWindow(): " << type << " "
													 << nameVect << " has wrong axis name (is " << lastChar << ")" << endl;
								break;
						}
						par->Set(nameVect, vect);
					}
					else if (mode == write)
					{
						CVector4 vect = par->Get<CVector4>(nameVect);
						double value = 0;

						switch (lastChar)
						{
							case 'x': value = vect.x; break;

							case 'y': value = vect.y; break;

							case 'z': value = vect.z; break;

							case 'w': value = vect.w; break;

							default:
								qWarning() << "cInterface::SynchronizeInterfaceWindow(): " << type << " "
													 << nameVect << " has wrong axis name (is " << lastChar << ")" << endl;
								break;
						}
						spinbox->setValue(value);
					}
				}
			}
		}
	}

	WriteLog("cInterface::SynchronizeInterface: QSpinBox", 3);
	//------------ integer spin-box --------------
	{
		QList<QSpinBox *> widgetListDoubleSpinBox = window->findChildren<QSpinBox *>();
		QList<QSpinBox *>::iterator it;
		for (it = widgetListDoubleSpinBox.begin(); it != widgetListDoubleSpinBox.end(); ++it)
		{
			QString name = (*it)->objectName();
			// qDebug() << "QDoubleSpinBox:" << (*it)->objectName() << " Type:" <<
			// (*it)->metaObject()->className() << endl;
			QString className = (*it)->metaObject()->className();
			if (name.length() > 1
					&& (className == QString("QSpinBox") || className == QString("MySpinBox")))
			{
				QSpinBox *spinbox = *it;
				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				if (className == QString("MySpinBox"))
				{
					MySpinBox *myspinbox = (MySpinBox *)*it;
					myspinbox->AssignParameterContainer(par);
					myspinbox->AssignParameterName(parameterName);
				}

				if (type == QString("spinboxInt"))
				{
					if (mode == read)
					{
						int value = spinbox->value();
						par->Set(parameterName, value);
					}
					else if (mode == write)
					{
						int value = par->Get<int>(parameterName);
						spinbox->setValue(value);
					}
				}
			}
		}
	}

	WriteLog("cInterface::SynchronizeInterface: QCheckBox", 3);
	// checkboxes
	{
		QList<QCheckBox *> widgetListDoubleSpinBox = window->findChildren<QCheckBox *>();
		QList<QCheckBox *>::iterator it;
		for (it = widgetListDoubleSpinBox.begin(); it != widgetListDoubleSpinBox.end(); ++it)
		{
			QString name = (*it)->objectName();
			// qDebug() << "QCheckBox:" << (*it)->objectName() << " Type:" <<
			// (*it)->metaObject()->className() << endl;
			QString className = (*it)->metaObject()->className();
			if (name.length() > 1
					&& (className == QString("QCheckBox") || className == QString("MyCheckBox")))
			{
				QCheckBox *checkbox = *it;

				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				if (className == QString("MyCheckBox"))
				{
					MyCheckBox *mycheckbox = (MyCheckBox *)*it;
					mycheckbox->AssignParameterContainer(par);
					mycheckbox->AssignParameterName(parameterName);
				}

				if (type == QString("checkBox"))
				{
					if (mode == read)
					{
						bool value = checkbox->isChecked();
						par->Set(parameterName, value);
					}
					else if (mode == write)
					{
						bool value = par->Get<bool>(parameterName);
						checkbox->setChecked(value);
					}
				}
			}
		}
	}

	WriteLog("cInterface::SynchronizeInterface: QGroupBox", 3);
	// groupsBox with checkbox
	{
		QList<QGroupBox *> widgetListDoubleSpinBox = window->findChildren<QGroupBox *>();
		QList<QGroupBox *>::iterator it;
		for (it = widgetListDoubleSpinBox.begin(); it != widgetListDoubleSpinBox.end(); ++it)
		{
			QString name = (*it)->objectName();
			// qDebug() << "QGroupBox:" << (*it)->objectName() << " Type:" <<
			// (*it)->metaObject()->className() << endl;
			QString className = (*it)->metaObject()->className();
			if (name.length() > 1
					&& (className == QString("QGroupBox") || className == QString("MyGroupBox")))
			{
				QGroupBox *groupbox = *it;

				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				if (className == QString("MyGroupBox"))
				{
					MyGroupBox *mygroupbox = (MyGroupBox *)*it;
					mygroupbox->AssignParameterContainer(par);
					mygroupbox->AssignParameterName(parameterName);
				}

				if (type == QString("groupCheck"))
				{
					if (mode == read)
					{
						bool value = groupbox->isChecked();
						par->Set(parameterName, value);
					}
					else if (mode == write)
					{
						bool value = par->Get<bool>(parameterName);
						groupbox->setChecked(value);
					}
				}
			}
		}
	}

	WriteLog("cInterface::SynchronizeInterface: FileSelectWidget", 3);
	//---------- file select widgets -----------
	{
		QList<FileSelectWidget *> widgetListPushButton = window->findChildren<FileSelectWidget *>();
		QList<FileSelectWidget *>::iterator it;
		for (it = widgetListPushButton.begin(); it != widgetListPushButton.end(); ++it)
		{
			QString name = (*it)->objectName();
			// QString className = (*it)->metaObject()->className();
			if (name.length() > 1 && (*it)->metaObject()->className() == QString("FileSelectWidget"))
			{
				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				FileSelectWidget *fileSelectWidget = *it;
				fileSelectWidget->AssignParameterContainer(par);
				fileSelectWidget->AssignParameterName(parameterName);

				if (mode == read)
				{
					par->Set(parameterName, fileSelectWidget->GetPath());
				}
				else if (mode == write)
				{
					fileSelectWidget->SetPath(par->Get<QString>(parameterName));
				}
			}
		}
	}

	WriteLog("cInterface::SynchronizeInterface: MyColorButton", 3);
	//---------- color buttons -----------
	{
		QList<MyColorButton *> widgetListPushButton = window->findChildren<MyColorButton *>();
		QList<MyColorButton *>::iterator it;
		for (it = widgetListPushButton.begin(); it != widgetListPushButton.end(); ++it)
		{
			QString name = (*it)->objectName();
			// QString className = (*it)->metaObject()->className();
			if (name.length() > 1 && (*it)->metaObject()->className() == QString("MyColorButton"))
			{
				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				MyColorButton *colorButton = *it;
				colorButton->AssignParameterContainer(par);
				colorButton->AssignParameterName(parameterName);

				if (mode == read)
				{
					par->Set(parameterName, colorButton->GetColor());
				}
				else if (mode == write)
				{
					colorButton->setText("");
					colorButton->SetColor(par->Get<sRGB>(parameterName));
				}
			}
		}
	}

	WriteLog("cInterface::SynchronizeInterface: ColorPaletteWidget", 3);
	//---------- colorpalette -----------
	{
		QList<ColorPaletteWidget *> widgetListColorPalette =
			window->findChildren<ColorPaletteWidget *>();
		QList<ColorPaletteWidget *>::iterator it;
		for (it = widgetListColorPalette.begin(); it != widgetListColorPalette.end(); ++it)
		{
			QString name = (*it)->objectName();
			// qDebug() << "ColorPalette:" << (*it)->objectName() << " Type:" <<
			// (*it)->metaObject()->className() << endl;
			if (name.length() > 1 && (*it)->metaObject()->className() == QString("ColorPaletteWidget"))
			{
				ColorPaletteWidget *colorPaletteWidget = *it;

				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				colorPaletteWidget->AssignParameterContainer(par);
				colorPaletteWidget->AssignParameterName(parameterName);

				if (type == QString("colorpalette"))
				{
					if (mode == read)
					{
						cColorPalette palette = colorPaletteWidget->GetPalette();
						par->Set(parameterName, palette);
					}
					else if (mode == write)
					{
						cColorPalette palette = par->Get<cColorPalette>(parameterName);
						colorPaletteWidget->SetPalette(palette);
					}
				}
			}
		}
	}

	WriteLog("cInterface::SynchronizeInterface: QComboBox", 3);
	// combo boxes
	{
		QList<QComboBox *> widgetListPushButton = window->findChildren<QComboBox *>();
		QList<QComboBox *>::iterator it;
		for (it = widgetListPushButton.begin(); it != widgetListPushButton.end(); ++it)
		{
			QString name = (*it)->objectName();
			// qDebug() << "QComboBox:" << (*it)->objectName() << " Type:" <<
			// (*it)->metaObject()->className() << endl;
			if (name.length() > 1 && (*it)->metaObject()->className() == QString("QComboBox"))
			{
				QComboBox *comboBox = *it;

				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				if (type == QString("comboBox"))
				{
					if (mode == read)
					{
						int selection = comboBox->currentIndex();
						if (parameterName.left(7) == QString("formula"))
						{
							selection = fractalList[comboBox->itemData(selection).toInt()].internalID;
						}
						par->Set(parameterName, selection);
					}
					else if (mode == write)
					{
						int selection = par->Get<int>(parameterName);
						if (parameterName.left(7) == QString("formula"))
						{
							for (int i = 0; i < fractalList.size(); i++)
							{
								if (fractalList[i].internalID == selection)
								{
									selection = comboBox->findData(i);
									break;
								}
							}
						}
						comboBox->setCurrentIndex(selection);
					}
				}
			}
		}
	}

	WriteLog("cInterface::SynchronizeInterface: cMaterialSelector", 3);
	//---------- material selector -----------
	{
		QList<cMaterialSelector *> widgetListMaterialSelector =
			window->findChildren<cMaterialSelector *>();
		QList<cMaterialSelector *>::iterator it;
		for (it = widgetListMaterialSelector.begin(); it != widgetListMaterialSelector.end(); ++it)
		{
			QString name = (*it)->objectName();
			// QString className = (*it)->metaObject()->className();
			if (name.length() > 1 && (*it)->metaObject()->className() == QString("cMaterialSelector"))
			{
				QString type, parameterName;
				GetNameAndType(name, &parameterName, &type);

				cMaterialSelector *materialSelector = *it;
				materialSelector->AssignParameterContainer(par);
				materialSelector->AssignParameterName(parameterName);

				if (type == QString("materialselector"))
				{
					if (mode == read)
					{
						par->Set(parameterName, materialSelector->GetMaterialIndex());
					}
					else if (mode == write)
					{
						materialSelector->SetMaterialIndex(par->Get<int>(parameterName));
					}
				}
			}
		}
	}
	WriteLog("cInterface::SynchronizeInterface: Done", 3);
}