2012-06-02 09:46:24 +00:00
|
|
|
#include "inputmaterial.h"
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QColorDialog>
|
2013-08-18 15:13:15 +00:00
|
|
|
|
2013-11-12 20:34:35 +00:00
|
|
|
#include "lighting/DialogMaterialEditor.h"
|
|
|
|
#include "previewmaterial.h"
|
2012-06-02 09:46:24 +00:00
|
|
|
|
|
|
|
InputMaterial::InputMaterial(QWidget* form, QString label, SurfaceMaterial* value) : BaseInput(form, label)
|
|
|
|
{
|
|
|
|
_value = value;
|
2013-08-18 15:13:15 +00:00
|
|
|
|
2012-06-02 14:17:01 +00:00
|
|
|
_preview = new SmallMaterialPreview(form, value);
|
2012-06-02 09:46:24 +00:00
|
|
|
_preview->setMinimumSize(100, 40);
|
2013-08-18 15:13:15 +00:00
|
|
|
|
2012-06-02 09:46:24 +00:00
|
|
|
_control = new QPushButton(tr("Edit"), form);
|
|
|
|
_control->setMaximumWidth(150);
|
|
|
|
|
|
|
|
connect((QPushButton*)_control, SIGNAL(clicked()), this, SLOT(editMaterial()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void InputMaterial::updatePreview()
|
|
|
|
{
|
|
|
|
_preview->update();
|
|
|
|
|
|
|
|
BaseInput::updatePreview();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InputMaterial::applyValue()
|
|
|
|
{
|
|
|
|
BaseInput::applyValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InputMaterial::revert()
|
|
|
|
{
|
|
|
|
BaseInput::revert();
|
|
|
|
}
|
|
|
|
|
|
|
|
void InputMaterial::editMaterial()
|
|
|
|
{
|
2013-08-18 15:13:15 +00:00
|
|
|
if (DialogMaterialEditor::getMaterial(_control, _value))
|
2012-06-02 09:46:24 +00:00
|
|
|
{
|
|
|
|
applyValue();
|
|
|
|
}
|
|
|
|
}
|