1#include <Dataflow/QtGui/GraphEditor/WidgetFactory.hpp>
9 auto line =
new QLineEdit();
10 line->setObjectName( QString::fromStdString( name ) );
12 line, &QLineEdit::textEdited, [&p](
const QString&
string ) { p =
string.toStdString(); } );
16#if HAS_TRANSFER_FUNCTION
20WidgetFactory::registerWidget<std::array<float, 256 * 4>>(
21 []( EditableParameterBase* editableParameter ) {
22 auto editableTransferFunction =
23 dynamic_cast<EditableParameter<std::array<float, 256 * 4>
>*>( editableParameter );
26 auto button =
new QPushButton(
"Open widget" );
27 auto transferEditor =
new TransferEditor();
28 TransferEditor::connect(
30 &TransferEditor::propertiesChanged,
31 [editableTransferFunction, transferEditor]() {
33 for (
int i = 0; i < 256; i++ ) {
34 unsigned int color = transferEditor->colorAt( i );
35 editableTransferFunction->m_data.at( pos ) =
36 (
unsigned char)( ( 0x00ff0000 & color ) >> 16 ) / 255.f;
37 editableTransferFunction->m_data.at( pos + 1 ) =
38 (
unsigned char)( ( 0x0000ff00 & color ) >> 8 ) / 255.f;
39 editableTransferFunction->m_data.at( pos + 2 ) =
40 (
unsigned char)( ( 0x000000ff & color ) ) / 255.f;
41 editableTransferFunction->m_data.at( pos + 3 ) =
42 (
unsigned char)( ( 0xff000000 & color ) >> 24 ) / 255.f;
47 button, &QPushButton::clicked, [transferEditor]() { transferEditor->show(); } );
50 []( QWidget*, EditableParameterBase* ) ->
bool {
return false; } );
hepler function to manage enum as underlying types in VariableSet