コード例 #1
0
LightPropertyWidget::LightPropertyWidget(FloatVec4Property* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
    , noUpdateFromProp_(false)
{
    light_ = new LightWidget(this);
    followCam_ = new QCheckBox(tr("Follow Camera"), this);
    if (BoolMetaData* follow = dynamic_cast<BoolMetaData*>(property_->getMetaDataContainer().getMetaData("FollowCamera")))
        followCam_->setChecked(follow->getValue());
    else
        followCam_->setChecked(false);

    layout_->setDirection(QBoxLayout::TopToBottom);
    layout_->addWidget(light_);
    layout_->addWidget(followCam_);
    connect(light_, SIGNAL(lightWidgetChanged(tgt::vec4)), this, SLOT(changeWidgetLight(tgt::vec4)));

    CameraProperty* camProp = getCamera();
    if(camProp) {
        camProp->onChange(CallMemberAction<LightPropertyWidget>(this, &LightPropertyWidget::cameraUpdate));
        light_->setLightPosition(camProp->get().getViewMatrix().getRotationalPart() * property_->get());
        cameraUpdate();
    }

    addVisibilityControls();
    // we have to add this widget to the property to enable automatic metadata serialization
    property_->addWidget(this);
}
コード例 #2
0
StringExpressionPropertyWidget::StringExpressionPropertyWidget(StringExpressionProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
{

    QVBoxLayout* verticalLayout = new QVBoxLayout();
    addLayout(verticalLayout);

    QHBoxLayout* topLayout = new QHBoxLayout();
    verticalLayout->addLayout(topLayout);

    // label
    nameLabel_ = new CustomLabel(prop_->getGuiName().c_str(), const_cast<StringExpressionPropertyWidget*>(this), 
        const_cast<StringExpressionPropertyWidget*>(this), 0, false, true);
    nameLabel_->setMinimumWidth(80);
    //nameLabel_->setWordWrap(true);
    QFontInfo fontInfo(font());
    nameLabel_->setFont(QFont(fontInfo.family(), fontSize_));
    nameLabel_->setToolTip("id: " + QString::fromStdString(prop_->getID()));
    nameLabel_->setVisible(isVisible());
    nameLabel_->setEnabled(isEnabled());
    topLayout->addWidget(nameLabel_, 2);

    //comboBox
    comboBox_ = new QComboBox();
    comboBox_->setMaximumWidth(200);
    topLayout->addWidget(comboBox_, 3);

    //text field
    textEdit_ = new QTextEdit(QString(prop->get().c_str()));
    verticalLayout->addWidget(textEdit_);

    connect(textEdit_, SIGNAL(textChanged()), this, SLOT(setProperty()));
    connect(textEdit_, SIGNAL(textChanged()), this, SIGNAL(widgetChanged()));
    
    //QFontInfo fontInfo(font());
    comboBox_->setFont(QFont(fontInfo.family(), QPropertyWidget::fontSize_));

    //connect(comboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(setProperty(std::string)));
    connect(comboBox_, SIGNAL(currentIndexChanged(int)), this, SLOT(clicked()));

    //button
    //button_ = new QPushButton("Add");

    //connect(button_, SIGNAL(clicked()), this, SLOT(clicked()));
    //connect(button_, SIGNAL(clicked(void)), this, SIGNAL(widgetChanged(void)));
    //addWidget(button_);
    //button_->setFont(QFont(fontInfo.family(), QPropertyWidget::fontSize_));

    //update and make visible
    updateFromProperty();

    addVisibilityControls();
}
コード例 #3
0
ButtonPropertyWidget::ButtonPropertyWidget(ButtonProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent, false)
    , property_(prop)
    , button_(new QPushButton(prop->getGuiName().c_str()))
{
    connect(button_, SIGNAL(clicked()), this, SLOT(clicked()));
    connect(button_, SIGNAL(clicked(void)), this, SIGNAL(widgetChanged(void)));
    addWidget(button_);
    addVisibilityControls();
    QFontInfo fontInfo(font());
    button_->setFont(QFont(fontInfo.family(), QPropertyWidget::fontSize_));
}
コード例 #4
0
StringPropertyWidget::StringPropertyWidget(StringProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
{
    lineEdit_ = new QLineEdit(QString(prop->get().c_str()));
    addWidget(lineEdit_);

    connect(lineEdit_, SIGNAL(textChanged(QString)), this, SLOT(setProperty(QString)));
    connect(lineEdit_, SIGNAL(textChanged(QString)), this, SIGNAL(widgetChanged()));

    addVisibilityControls();
}
コード例 #5
0
ColorPropertyWidget::ColorPropertyWidget(FloatVec4Property* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
    , colorLbl_(new ClickableColorLabel(""))
    , currentColor_(toQColor(prop->get()))
{
    updateColorLabel();
    addWidget(colorLbl_);
    connect(colorLbl_, SIGNAL(clicked(void)), this, SLOT(setProperty(void)));
    connect(colorLbl_, SIGNAL(clicked(void)), this, SIGNAL(widgetChanged(void)));

    addVisibilityControls();
    setMinimumHeight(18);
}
コード例 #6
0
PlotDataPropertyWidget::PlotDataPropertyWidget(PlotDataProperty* prop, QWidget* parent)
    : QPropertyWidgetWithEditorWindow(prop, parent, true, false)
    , editBt_(new QPushButton(tr("Show Data")))
    , property_(prop)
    , plotDataWidget_(0)
    , updateFromPropertyFlag_(true)
{
    createEditorWindow(Qt::LeftDockWidgetArea);

    addWidget(editBt_);
    connect(editBt_, SIGNAL(clicked()), this, SLOT(toggleWidgetVisibility()));

    addVisibilityControls();
    QFontInfo fontInfo(font());
    editBt_->setFont(QFont(fontInfo.family(), QPropertyWidget::fontSize_));
}
コード例 #7
0
FileDialogPropertyWidget::FileDialogPropertyWidget(FileDialogProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
    , openFileDialogBtn_(new QPushButton)
{
    updateButtonText(prop->get());

    connect(openFileDialogBtn_, SIGNAL(clicked(void)), this, SLOT(setProperty(void)));

    addWidget(openFileDialogBtn_);

    addVisibilityControls();

    QFontInfo fontInfo(font());
    openFileDialogBtn_->setFont(QFont(fontInfo.family(), QPropertyWidget::fontSize_));
}
コード例 #8
0
LightPropertyWidget::LightPropertyWidget(LightSourceProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
{
    light_ = new LightWidget(this);
    followCam_ = new QCheckBox(tr("Follow Camera"), this);

    layout_->setDirection(QBoxLayout::TopToBottom);
    layout_->addWidget(light_);
    layout_->addWidget(followCam_);
    connect(light_, SIGNAL(lightWidgetChanged(tgt::vec4)), this, SLOT(changeWidgetLight(tgt::vec4)));
    connect(followCam_, SIGNAL(toggled(bool)), this, SLOT(changeFollowCam(bool)));

    updateFromPropertySlot();

    addVisibilityControls();
}
コード例 #9
0
OpenCLPropertyWidget::OpenCLPropertyWidget(OpenCLProperty* prop, QWidget* parent)
    : QPropertyWidgetWithEditorWindow(prop, parent)
    , plugin_(0)
    , property_(prop)
    , editBt_(new QPushButton(tr("edit")))
{

    if (editorVisibleOnStartup())
        createEditorWindow(Qt::LeftDockWidgetArea, QString::fromStdString(" (original source: " + property_->get().programFilename_ + ")"), 700, 700);

    addWidget(editBt_);

    connect(editBt_, SIGNAL(clicked()), this, SLOT(setProperty()));
    connect(editBt_, SIGNAL(clicked()), this, SIGNAL(widgetChanged()));

    addVisibilityControls();

    QFontInfo fontInfo(font());
    editBt_->setFont(QFont(fontInfo.family(), QPropertyWidget::fontSize_));
}
コード例 #10
0
SpatialTransFuncPropertyWidget::SpatialTransFuncPropertyWidget(SpatialTransFuncProperty* prop, QWidget* parent)
    : QPropertyWidgetWithEditorWindow(prop, parent, false)
    , plugin_(0)
    , property_(prop)
    , editBt_(new QPushButton(tr("edit")))
{

    tgtAssert(prop, "No property passed");

    if (!prop->getLazyEditorInstantiation() || editorVisibleOnStartup())
        createEditorWindow(Qt::RightDockWidgetArea);

    addWidget(editBt_);

    connect(editBt_, SIGNAL(clicked()), this, SLOT(setProperty()));
    connect(editBt_, SIGNAL(clicked()), this, SIGNAL(widgetChanged()));

    addVisibilityControls();
    QFontInfo fontInfo(font());
    editBt_->setFont(QFont(fontInfo.family(), QPropertyWidget::fontSize_));
}
コード例 #11
0
FontPropertyWidget::FontPropertyWidget(FontProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
{
    groupBox_ = new QGroupBox(this);
    addWidget(groupBox_);

    QVBoxLayout* tgtFontLayout = new QVBoxLayout(groupBox_);
    tgtFontLayout->setContentsMargins(2,2,2,2);

    tgtFontType_ = new QComboBox();
    tgtFontType_->addItem("Bitmap", (int)tgt::Font::BitmapFont);
    tgtFontType_->addItem("Buffer", (int)tgt::Font::BufferFont);
    tgtFontType_->addItem("Extrude", (int)tgt::Font::ExtrudeFont);
    tgtFontType_->addItem("Outline", (int)tgt::Font::OutlineFont);
    tgtFontType_->addItem("Pixmap", (int)tgt::Font::PixmapFont);
    tgtFontType_->addItem("Polygon", (int)tgt::Font::PolygonFont);
    tgtFontType_->addItem("Texture", (int)tgt::Font::TextureFont);
    tgtFontLayout->addWidget(tgtFontType_);

    tgtFontName_ = new QComboBox();
    tgtFontName_->addItem("VeraMono", "VeraMono.ttf");
    tgtFontName_->addItem("Vera", "Vera.ttf");
    tgtFontLayout->addWidget(tgtFontName_);

    QLabel* fontSizeLabel = new QLabel("Fontsize:");
    tgtFontLayout->addWidget(fontSizeLabel);

    QWidget* tgtFontSize = new QWidget();
    QHBoxLayout* tgtFontSizeLayout = new QHBoxLayout(tgtFontSize);
    tgtFontSizeLayout->setContentsMargins(0,0,0,0);
    tgtFontSizeSlider_ = new QSlider(Qt::Horizontal);
    tgtFontSizeLayout->addWidget(tgtFontSizeSlider_);
    QLCDNumber* tgtFontSizeLCD = new QLCDNumber(2);
    tgtFontSizeLayout->addWidget(tgtFontSizeLCD);
    tgtFontLayout->addWidget(tgtFontSize);

    QLabel* lineWidthLabel = new QLabel("Line width:");
    tgtFontLayout->addWidget(lineWidthLabel);

    QWidget* tgtLineWidth = new QWidget();
    QHBoxLayout* tgtLineWidthLayout = new QHBoxLayout(tgtLineWidth);
    tgtLineWidthLayout->setContentsMargins(0,0,0,0);
    tgtLineWidthSlider_ = new QSlider(Qt::Horizontal);
    tgtLineWidthLayout->addWidget(tgtLineWidthSlider_);
    QLCDNumber* tgtLineWidthLCD = new QLCDNumber(3);
    tgtLineWidthLayout->addWidget(tgtLineWidthLCD);
    tgtFontLayout->addWidget(tgtLineWidth);

    tgtTextAlign_ = new QComboBox();
    tgtTextAlign_->addItem("Left", (int)tgt::Font::Left);
    tgtTextAlign_->addItem("Center", (int)tgt::Font::Center);
    tgtTextAlign_->addItem("Right", (int)tgt::Font::Right);
    tgtFontLayout->addWidget(tgtTextAlign_);

    tgtVerticalTextAlign_ = new QComboBox();
    tgtVerticalTextAlign_->addItem("Top", (int)tgt::Font::Top);
    tgtVerticalTextAlign_->addItem("Middle", (int)tgt::Font::Middle);
    tgtVerticalTextAlign_->addItem("Bottom", (int)tgt::Font::Bottom);
    tgtFontLayout->addWidget(tgtVerticalTextAlign_);

    tgtFontSizeLCD->setSegmentStyle(QLCDNumber::Filled);
    tgtLineWidthLCD->setSegmentStyle(QLCDNumber::Filled);

    tgtFontSizeSlider_->setMinimum(6);
    tgtFontSizeSlider_->setMaximum(36);

    tgtLineWidthSlider_->setMinimum(10);
    tgtLineWidthSlider_->setMaximum(999);

    connect(tgtFontType_,        SIGNAL(activated(int)),     this,            SLOT(updateProperty()));
    connect(tgtFontName_,        SIGNAL(activated(int)),     this,            SLOT(updateProperty()));
    connect(tgtFontSizeSlider_,  SIGNAL(valueChanged(int)),  this,            SLOT(updateProperty()));
    connect(tgtFontSizeSlider_,  SIGNAL(valueChanged(int)),  tgtFontSizeLCD,  SLOT(display(int)));
    connect(tgtLineWidthSlider_, SIGNAL(valueChanged(int)),  this,            SLOT(updateProperty()));
    connect(tgtLineWidthSlider_, SIGNAL(valueChanged(int)),  tgtLineWidthLCD, SLOT(display(int)));

    connect(tgtTextAlign_,        SIGNAL(currentIndexChanged(int)),     this,            SLOT(updateProperty()));
    connect(tgtVerticalTextAlign_,SIGNAL(currentIndexChanged(int)),     this,            SLOT(updateProperty()));

    updateFromProperty();
    addVisibilityControls();
}
コード例 #12
0
PlotZoomPropertyWidget::PlotZoomPropertyWidget(PlotSelectionProperty* prop, QWidget* parent)
    : QPropertyWidget(prop, parent)
    , property_(prop)
    , lblX_(0)
    , lblY_(0)
    , lblZ_(0)
    , btnPush_(0)
    , btnPop_(0)
    , spXlow_(0)
    , spXhigh_(0)
    , spYlow_(0)
    , spYhigh_(0)
    , spZlow_(0)
    , spZhigh_(0)
    {
    QWidget* mainWidget = new QWidget(this);
    QGridLayout* gl = new QGridLayout();

    lblX_ = new QLabel(tr("x Axis:"));
    spXlow_ = new QDoubleSpinBox();
    spXlow_->setDecimals(4);
    spXhigh_ = new QDoubleSpinBox();
    spXhigh_->setDecimals(4);

    gl->addWidget(lblX_, 0, 0);
    gl->addWidget(spXlow_, 0, 1);
    gl->addWidget(spXhigh_, 0, 2);

    lblY_ = new QLabel(tr("y Axis:"));
    spYlow_ = new QDoubleSpinBox();
    spYlow_->setDecimals(4);
    spYhigh_ = new QDoubleSpinBox();
    spYhigh_->setDecimals(4);

    gl->addWidget(lblY_, 1, 0);
    gl->addWidget(spYlow_, 1, 1);
    gl->addWidget(spYhigh_, 1, 2);

    lblZ_ = new QLabel(tr("z Axis:"));
    spZlow_ = new QDoubleSpinBox();
    spZlow_->setDecimals(4);
    spZhigh_ = new QDoubleSpinBox();
    spZhigh_->setDecimals(4);

    gl->addWidget(lblZ_, 2, 0);
    gl->addWidget(spZlow_, 2, 1);
    gl->addWidget(spZhigh_, 2, 2);

    btnPush_ =  new QPushButton(tr("Apply"));
    btnPop_ =  new QPushButton(tr("Undo"));
    gl->addWidget(btnPush_, 3, 1);
    gl->addWidget(btnPop_, 3, 2);

    connect(btnPop_, SIGNAL(clicked()), this, SLOT(btnPopClicked()));
    connect(btnPush_, SIGNAL(clicked()), this, SLOT(btnPushClicked()));

    connect(spXlow_, SIGNAL(editingFinished()), this, SLOT(setSpinBoxRanges()));
    connect(spXhigh_, SIGNAL(editingFinished()), this, SLOT(setSpinBoxRanges()));
    connect(spYlow_, SIGNAL(editingFinished()), this, SLOT(setSpinBoxRanges()));
    connect(spYhigh_, SIGNAL(editingFinished()), this, SLOT(setSpinBoxRanges()));

    updateFromProperty();

    mainWidget->setLayout(gl);
    addWidget(mainWidget);

    addVisibilityControls();
}