qse  0.5.4
qseenumparametereditor.cpp
Go to the documentation of this file.
2 #include "qseenumparameter.h"
3 
4 #include <QComboBox>
5 #include <QPushButton>
6 
7 #include <stdio.h>
8 
10 (QseOperatorEditor* ed, QseEnumParameter* param, QObject* parent)
11  : QseParameterEditor(ed, param, parent),
12  m_EnumParameter(param),
13  m_ComboBox(NULL)
14 {
15 }
16 
18 (QComboBox* combo, QPushButton* apply, QPushButton* cancel)
19 {
20  QseParameterEditor::setEditors(apply, cancel);
21 
22  m_ComboBox = combo;
23 
24  m_ComboBox -> clear();
25  m_ComboBox -> addItems(m_EnumParameter -> values());
26 
27  connect(m_ComboBox, SIGNAL(currentIndexChanged(int)),
28  this, SLOT(editorChanged()));
29 
30  editorCancel();
31 }
32 
34 {
35 // printf("Need QseEnumParameterEditor::editorValidate\n");
36 
37  return true;
38 }
39 
41 {
42  m_Parameter -> setValue(m_ComboBox -> currentIndex());
43 
44 // printf("QseEnumParameterEditor::editorApply: %s = %s\n",
45 // qPrintable(m_Parameter->name()),
46 // qPrintable(m_Parameter->value().toString()));
47 }
48 
50 {
51  m_ComboBox -> setCurrentIndex(m_Parameter->value().toInt());
52 }
QVariant value() const
QseEnumParameterEditor(QseOperatorEditor *ed, QseEnumParameter *param, QObject *parent=0)
QseParameter * m_Parameter
void setEditors(QComboBox *combo, QPushButton *apply, QPushButton *cancel)
void setEditors(QPushButton *apply, QPushButton *cancel)