コード例 #1
0
ファイル: FloatProperty.cpp プロジェクト: CgGraphic/tungsten
FloatProperty::FloatProperty(QWidget *parent, PropertySheet &sheet, std::string name, float value,
        std::function<bool(float)> setter)
: _value(value),
  _setter(std::move(setter))
{
    _nameLabel = new QLabel(QString::fromStdString(name + ":"), parent);
    _lineEdit = new QLineEdit(QString::number(value), parent);
    connect(_lineEdit, SIGNAL(editingFinished()), this, SLOT(textEdited()));

    sheet.addWidget(_nameLabel, sheet.rowCount(), 0);
    sheet.addWidget(_lineEdit, sheet.rowCount() - 1, 1);
}
コード例 #2
0
MediumProperty::MediumProperty(QWidget *parent, PropertySheet &sheet, std::string name, std::shared_ptr<Medium> value,
        std::function<bool(std::shared_ptr<Medium> &)> setter, Scene *scene)
: _value(std::move(value)),
  _setter(std::move(setter)),
  _scene(scene)
{
    _nameLabel = new QLabel(QString::fromStdString(name + ":"), parent);

    _mediumSelector = new QComboBox(parent);

    buildMediumList();

    sheet.addWidget(_nameLabel, sheet.rowCount(), 0);
    sheet.addWidget(_mediumSelector, sheet.rowCount() - 1, 1);
}