ReactionsWidget1::ReactionsWidget1(QWidget *parent, const char * name, Qt::WFlags f) : CopasiWidget(parent, name, f), mpRi(NULL) { if (!name) setName("ReactionsWidget1"); setCaption(trUtf8("ReactionsWidget1")); ReactionsWidget1Layout = new QGridLayout(this); ReactionsWidget1Layout->setMargin(11); ReactionsWidget1Layout->setSpacing(6); ReactionsWidget1Layout->setObjectName("ReactionsWidget1Layout"); TextLabel7 = new QLabel(this, "TextLabel7"); TextLabel7->setText(trUtf8("Symbol Definition")); TextLabel7->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); ReactionsWidget1Layout->addWidget(TextLabel7, 8, 0); Line2 = new QFrame(this, "Line2"); Line2->setFrameShape(QFrame::HLine); Line2->setFrameShadow(QFrame::Sunken); Line2->setFrameShape(QFrame::HLine); ReactionsWidget1Layout->addMultiCellWidget(Line2, 7, 7, 0, 3); // kinetics line TextLabel6 = new QLabel(this, "TextLabel6"); TextLabel6->setText(trUtf8("Rate Law")); TextLabel6->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); ReactionsWidget1Layout->addWidget(TextLabel6, 5, 0); ComboBox1 = new QComboBox(false, this, "ComboBox1"); ReactionsWidget1Layout->addMultiCellWidget(ComboBox1, 5, 5, 1, 2); newKinetics = new QPushButton(this, "newKinetics"); newKinetics->setText(trUtf8("&New Rate Law")); ReactionsWidget1Layout->addWidget(newKinetics, 5, 3); TextLabel8 = new QLabel(this, "TextLabel8"); TextLabel8->setText(trUtf8("Flux")); TextLabel8->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); ReactionsWidget1Layout->addWidget(TextLabel8, 6, 0); QPushButton* editKinetics = new QPushButton(this, "editKinetics"); editKinetics->setText(trUtf8("&Edit Rate Law")); ReactionsWidget1Layout->addWidget(editKinetics, 6, 3); connect(editKinetics, SIGNAL(clicked()), this, SLOT(slotGotoFunction())); LineEdit3 = new QLineEdit(this, "LineEdit3"); LineEdit3->setEnabled(false); ReactionsWidget1Layout->addMultiCellWidget(LineEdit3, 6, 6, 1, 2); // equation line TextLabel5 = new QLabel(this, "TextLabel5"); TextLabel5->setText(trUtf8("Reaction")); TextLabel5->setAlignment(int(Qt::AlignVCenter | Qt::AlignRight)); ReactionsWidget1Layout->addWidget(TextLabel5, 2, 0); LineEdit2 = new MyLineEdit(this, "LineEdit2"); LineEdit2->setValidator(new ChemEqValidator(LineEdit2)); ReactionsWidget1Layout->addMultiCellWidget(LineEdit2, 2, 2, 1, 3); CheckBox = new QCheckBox(this, "CheckBox"); CheckBox->setText(trUtf8("Reversible")); ReactionsWidget1Layout->addWidget(CheckBox, 3, 1); mpMultiCompartment = new QCheckBox(this, "mpMultiCompartment"); mpMultiCompartment->setText(trUtf8("Multi Compartment")); mpMultiCompartment->setEnabled(false); ReactionsWidget1Layout->addWidget(mpMultiCompartment, 3, 2); Line4 = new QFrame(this, "Line4"); Line4->setFrameShape(QFrame::HLine); Line4->setFrameShadow(QFrame::Sunken); Line4->setFrameShape(QFrame::HLine); ReactionsWidget1Layout->addMultiCellWidget(Line4, 4, 4, 0, 3); table = new ParameterTable(this, "table"); table->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); ReactionsWidget1Layout->addMultiCellWidget(table, 8, 9, 1, 3); ReactionsWidget1Layout->setRowStretch(9, 10); QSpacerItem* spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); ReactionsWidget1Layout->addItem(spacer, 10, 0); //ReactionsWidget1Layout->setRowStretch(10,1); setTabOrder(LineEdit2, CheckBox); setTabOrder(CheckBox, mpMultiCompartment); setTabOrder(mpMultiCompartment, ComboBox1); setTabOrder(ComboBox1, newKinetics); setTabOrder(newKinetics, table); connect(newKinetics, SIGNAL(clicked()), this, SLOT(slotNewFunction())); connect(CheckBox, SIGNAL(clicked()), this, SLOT(slotCheckBoxClicked())); connect(ComboBox1, SIGNAL(activated(const QString &)), this, SLOT(slotComboBoxSelectionChanged(const QString &))); connect(LineEdit2, SIGNAL(edited()), this, SLOT(slotLineEditChanged())); //connect(table, SIGNAL(signalChanged(int, int, Qstring)), this, SLOT(slotTableChanged(int, int, QString))); }
void PropertiesEditorItem::prepareWidget() { QWidget *editor = 0; if (mProperty.type() == QVariant::BitArray) { } else if (mProperty.type() == QVariant::Bitmap) { } else if (mProperty.type() == QVariant::Bool) { QCheckBox *checkBox = new QCheckBox(parent()); checkBox->setText(QString()); checkBox->setChecked(mProperty.read(mObject.data()).toBool()); editor = qobject_cast< QWidget* >(checkBox); connect(checkBox, SIGNAL(toggled(bool)), SLOT(slotCheckBoxToggled())); } else if (mProperty.type() == QVariant::Brush) { } else if (mProperty.type() == QVariant::ByteArray) { } else if (mProperty.type() == QVariant::Char) { } else if (mProperty.type() == QVariant::Color) { QPushButton *button = new QPushButton(parent()); button->setText(mProperty.read(mObject.data()).value<QColor>().name()); connect(button, SIGNAL(clicked(bool)), SLOT(slotOpenColorEditor())); editor = qobject_cast< QWidget* >(button); } else if (mProperty.type() == QVariant::Cursor) { } else if (mProperty.type() == QVariant::Date) { } else if (mProperty.type() == QVariant::DateTime) { } else if (mProperty.type() == QVariant::Double) { QDoubleSpinBox *spinBox = new QDoubleSpinBox(parent()); spinBox->setMaximum(LONG_MAX); spinBox->setMinimum(LONG_MIN); spinBox->setSingleStep(0.01); spinBox->setValue(mProperty.read(mObject.data()).toDouble()); editor = qobject_cast< QWidget* >(spinBox); connect(spinBox, SIGNAL(valueChanged(double)), SLOT(slotDoubleSpinBoxValueChanged())); } else if (mProperty.type() == QVariant::EasingCurve) { QPushButton *button = new QPushButton(parent()); QEasingCurve curve = mProperty.read(mObject.data()).toEasingCurve(); button->setText(curve.staticMetaObject.enumerator(0).valueToKey(curve.type())); connect(button, SIGNAL(clicked(bool)), SLOT(slotOpenEasingCurveEditor())); editor = qobject_cast< QWidget* >(button); } else if (mProperty.type() == QVariant::Font) { QFontComboBox *comboBox = new QFontComboBox(parent()); comboBox->setCurrentFont(mProperty.read(mObject.data()).value<QFont>()); editor = qobject_cast< QWidget* >(comboBox); connect(comboBox, SIGNAL(currentFontChanged(QFont)), SLOT(slotFontComboChanged())); } else if (mProperty.type() == QVariant::Hash) { } else if (mProperty.type() == QVariant::Icon) { } else if (mProperty.type() == QVariant::Image) { } else if (mProperty.type() == QVariant::Int) { QSpinBox *spinBox = new QSpinBox(parent()); spinBox->setMinimum(INT_MIN); spinBox->setMaximum(INT_MAX); spinBox->setValue(mProperty.read(mObject.data()).toInt()); editor = qobject_cast< QWidget* >(spinBox); connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotSpinBoxValueChanged())); } else if (mProperty.type() == QVariant::KeySequence) { } else if (mProperty.type() == QVariant::Line) { } else if (mProperty.type() == QVariant::LineF) { } else if (mProperty.type() == QVariant::List) { } else if (mProperty.type() == QVariant::Locale) { } else if (mProperty.type() == QVariant::LongLong) { QDoubleSpinBox *spinBox = new QDoubleSpinBox(parent()); spinBox->setSingleStep(1.0); spinBox->setDecimals(0); spinBox->setMaximum(LONG_MAX); spinBox->setMinimum(LONG_MIN); spinBox->setValue(mProperty.read(mObject.data()).toLongLong()); editor = qobject_cast< QWidget* >(spinBox); connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotDoubleSpinBoxValueChanged())); } else if (mProperty.type() == QVariant::Map) { } else if (mProperty.type() == QVariant::Matrix) { } else if (mProperty.type() == QVariant::Matrix4x4) { } else if (mProperty.type() == QVariant::Palette) { } else if (mProperty.type() == QVariant::Pen) { } else if (mProperty.type() == QVariant::Pixmap) { } else if (mProperty.type() == QVariant::Point) { } else if (mProperty.type() == QVariant::PointF) { } else if (mProperty.type() == QVariant::Polygon) { } else if (mProperty.type() == QVariant::Quaternion) { } else if (mProperty.type() == QVariant::Rect) { } else if (mProperty.type() == QVariant::RectF) { } else if (mProperty.type() == QVariant::RegExp) { } else if (mProperty.type() == QVariant::Region) { } else if (mProperty.type() == QVariant::Size) { } else if (mProperty.type() == QVariant::SizeF) { } else if (mProperty.type() == QVariant::SizePolicy) { } else if (mProperty.type() == QVariant::String) { QLineEdit *lineEdit = new QLineEdit(parent()); lineEdit->setText(mProperty.read(mObject.data()).toString()); editor = qobject_cast< QWidget* >(lineEdit); connect(lineEdit, SIGNAL(textChanged(QString)), SLOT(slotLineEditChanged())); } else if (mProperty.type() == QVariant::StringList) { } else if (mProperty.type() == QVariant::TextFormat) { } else if (mProperty.type() == QVariant::TextLength) { } else if (mProperty.type() == QVariant::Time) { } else if (mProperty.type() == QVariant::Transform) { } else if (mProperty.type() == QVariant::UInt) { QSpinBox *spinBox = new QSpinBox(parent()); spinBox->setMaximum(UINT_MAX); spinBox->setMinimum(0); spinBox->setValue(mProperty.read(mObject.data()).toUInt()); editor = qobject_cast< QWidget* >(spinBox); connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotSpinBoxValueChanged())); } else if (mProperty.type() == QVariant::ULongLong) { QDoubleSpinBox *spinBox = new QDoubleSpinBox(parent()); spinBox->setSingleStep(1.0); spinBox->setDecimals(0); spinBox->setMinimum(0); spinBox->setMaximum(ULONG_MAX); spinBox->setValue(mProperty.read(mObject.data()).toULongLong()); editor = qobject_cast< QWidget* >(spinBox); connect(spinBox, SIGNAL(valueChanged(int)), SLOT(slotDoubleSpinBoxValueChanged())); } else if (mProperty.type() == QVariant::Url) { QPushButton *button = new QPushButton(parent()); QUrl url = mProperty.read(mObject.data()).toUrl(); setButtonUrl(button, url); editor = qobject_cast< QWidget* >(button); connect(button, SIGNAL(clicked(bool)), SLOT(slotUrlButtonClicked())); } else if (mProperty.type() == QVariant::UserType) { } else if (mProperty.type() == QVariant::Vector2D) { } else if (mProperty.type() == QVariant::Vector3D) { } else if (mProperty.type() == QVariant::Vector4D) { } mWidget = editor; }