Commit 89be8373 authored by schultezub's avatar schultezub
Browse files

fixed last commit

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@211 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent c16fc903
#include "transferfunctionpropertywidget.h"
namespace TUMVis {
TransferFunctionPropertyWidget::TransferFunctionPropertyWidget(TransferFunctionProperty* property, QWidget* parent /*= 0*/)
: AbstractPropertyWidget(property, parent)
, _widget(0)
, _gridLayout(0)
, _lblDomain(0)
, _spinDomainLeft(0)
, _spinDomainRight(0)
, _btnEditTF(0)
{
_widget = new QWidget(this);
_gridLayout = new QGridLayout(_widget);
_widget->setLayout(_gridLayout);
_lblDomain = new QLabel("Intensity Domain: ", _widget);
_gridLayout->addWidget(_lblDomain, 0, 0);
_spinDomainLeft = new QDoubleSpinBox(_widget);
_spinDomainLeft->setMinimum(0);
_spinDomainLeft->setDecimals(2);
_spinDomainLeft->setSingleStep(0.01);
_gridLayout->addWidget(_spinDomainLeft, 0, 1);
_spinDomainRight = new QDoubleSpinBox(_widget);
_spinDomainRight->setMaximum(1);
_spinDomainRight->setDecimals(2);
_spinDomainRight->setSingleStep(0.01);
_gridLayout->addWidget(_spinDomainRight, 0, 2);
updateWidgetFromProperty();
_btnEditTF = new QPushButton("Edit Transfer Function", _widget);
_gridLayout->addWidget(_btnEditTF, 1, 0, 1, 3);
addWidget(_widget);
connect(_spinDomainLeft, SIGNAL(valueChanged(double)), this, SLOT(onDomainChanged(double)));
connect(_spinDomainRight, SIGNAL(valueChanged(double)), this, SLOT(onDomainChanged(double)));
connect(_btnEditTF, SIGNAL(clicked(bool)), this, SLOT(onEditClicked(bool)));
}
TransferFunctionPropertyWidget::~TransferFunctionPropertyWidget() {
}
void TransferFunctionPropertyWidget::updateWidgetFromProperty() {
TransferFunctionProperty* prop = static_cast<TransferFunctionProperty*>(_property);
AbstractTransferFunction* tf = prop->getTF();
const tgt::vec2& domain = tf->getIntensityDomain();
_spinDomainLeft->blockSignals(true);
_spinDomainLeft->setMaximum(domain.y);
_spinDomainLeft->setValue(domain.x);
_spinDomainLeft->blockSignals(false);
_spinDomainRight->blockSignals(true);
_spinDomainRight->setMinimum(domain.x);
_spinDomainRight->setValue(domain.y);
_spinDomainRight->blockSignals(false);
}
void TransferFunctionPropertyWidget::onDomainChanged(double value) {
TransferFunctionProperty* prop = static_cast<TransferFunctionProperty*>(_property);
_ignorePropertyUpdates = true;
_spinDomainLeft->setMaximum(_spinDomainRight->value());
_spinDomainRight->setMinimum(_spinDomainLeft->value());
tgt::vec2 newDomain(static_cast<float>(_spinDomainLeft->value()), static_cast<float>(_spinDomainRight->value()));
prop->getTF()->setIntensityDomain(newDomain);
_ignorePropertyUpdates = false;
}
void TransferFunctionPropertyWidget::onEditClicked(bool checked) {
// open editor window
}
}
\ No newline at end of file
#ifndef TRANSFERFUNCTIONPROPERTYWIDGET_H__
#define TRANSFERFUNCTIONPROPERTYWIDGET_H__
#include "application/gui/properties/abstractpropertywidget.h"
#include "core/properties/transferfunctionproperty.h"
#include <QDoubleSpinBox>
#include <QGridLayout>
#include <QLabel>
#include <QPushButton>
namespace TUMVis {
/**
* Widget for a TransferFunctionProperty
*/
class TransferFunctionPropertyWidget : public AbstractPropertyWidget {
Q_OBJECT;
public:
/**
* Creates a new PropertyWidget for the property \a property.
* \param property The property the widget shall handle
* \param parent Parent Qt widget
*/
TransferFunctionPropertyWidget(TransferFunctionProperty* property, QWidget* parent = 0);
/**
* Destructor
*/
virtual ~TransferFunctionPropertyWidget();
protected:
/**
* Gets called when the property has changed, so that widget can update its state.
*/
virtual void updateWidgetFromProperty();
private slots:
/// slot called when one of the intensity domain spin edits has changed
void onDomainChanged(double value);
/// slot called when edit TF button clicked
void onEditClicked(bool checked);
private:
QWidget* _widget; ///< Widget grouping the widgets together
QGridLayout* _gridLayout; ///< Layout for _widget
QLabel* _lblDomain; ///< intensity domain label
QDoubleSpinBox* _spinDomainLeft; ///< spin edit for intensity domain lower bound
QDoubleSpinBox* _spinDomainRight; ///< spin edit for intensity domain upper bound
QPushButton* _btnEditTF; ///< button for showing the TF editor widget
};
}
#endif // TRANSFERFUNCTIONPROPERTYWIDGET_H__
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment