void KnobGuiBool::createWidget(QHBoxLayout* layout) { KnobGuiPtr knobUI = getKnobGui(); _checkBox = new Bool_CheckBox( knobUI, DimIdx(0), getView(), layout->parentWidget() ); onLabelChanged(); //_checkBox->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE); QObject::connect( _checkBox, SIGNAL(clicked(bool)), this, SLOT(onCheckBoxStateChanged(bool)) ); QObject::connect( knobUI.get(), SIGNAL(labelClicked(bool)), this, SLOT(onLabelClicked(bool)) ); ///set the copy/link actions in the right click menu KnobGuiWidgets::enableRightClickMenu(knobUI, _checkBox, DimIdx(0), getView()); layout->addWidget(_checkBox); }
void KnobGuiWidgets::enableRightClickMenu(const KnobGuiPtr& knob, QWidget* widget, DimSpec dimension, ViewSetSpec view) { KnobIPtr internalKnob = knob->getKnob(); if (!internalKnob) { return; } KnobSeparatorPtr sep = toKnobSeparator(internalKnob); KnobGroupPtr grp = toKnobGroup(internalKnob); if (sep || grp) { return; } widget->setProperty(KNOB_RIGHT_CLICK_DIM_PROPERTY, QVariant(dimension)); widget->setProperty(KNOB_RIGHT_CLICK_VIEW_PROPERTY, QVariant(view)); widget->setContextMenuPolicy(Qt::CustomContextMenu); QObject::connect( widget, SIGNAL(customContextMenuRequested(QPoint)), knob.get(), SLOT(onRightClickClicked(QPoint)) ); }