MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / LinkToKnobDialog

Method LinkToKnobDialog

Gui/LinkToKnobDialog.cpp:121–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

119};
120
121LinkToKnobDialog::LinkToKnobDialog(const KnobGuiPtr& from,
122 QWidget* parent)
123 : QDialog(parent)
124 , _imp( new LinkToKnobDialogPrivate(from) )
125{
126 _imp->mainLayout = new QVBoxLayout(this);
127
128 _imp->firstLine = new QWidget(this);
129 _imp->firstLineLayout = new QHBoxLayout(_imp->firstLine);
130
131 _imp->mainLayout->addWidget(_imp->firstLine);
132
133 _imp->buttons = new DialogButtonBox(QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel),
134 Qt::Horizontal, this);
135 QObject::connect( _imp->buttons, SIGNAL(accepted()), this, SLOT(accept()) );
136 QObject::connect( _imp->buttons, SIGNAL(rejected()), this, SLOT(reject()) );
137 _imp->mainLayout->addWidget(_imp->buttons);
138
139 _imp->selectNodeLabel = new Label(tr("Parent:"), _imp->firstLine);
140 _imp->firstLineLayout->addWidget(_imp->selectNodeLabel);
141
142
143 EffectInstance* isEffect = dynamic_cast<EffectInstance*>( from->getKnob()->getHolder() );
144 assert(isEffect);
145 if (!isEffect) {
146 throw std::logic_error("");
147 }
148 NodeCollectionPtr group = isEffect->getNode()->getGroup();
149 group->getActiveNodes(&_imp->allNodes);
150 NodeGroup* isGroup = dynamic_cast<NodeGroup*>( group.get() );
151 if (isGroup) {
152 _imp->allNodes.push_back( isGroup->getNode() );
153 }
154 QStringList nodeNames;
155 for (NodesList::iterator it = _imp->allNodes.begin(); it != _imp->allNodes.end(); ++it) {
156 QString name = QString::fromUtf8( (*it)->getLabel().c_str() );
157 nodeNames.push_back(name);
158 //_imp->nodeSelectionCombo->addItem(name);
159 }
160 nodeNames.sort();
161 _imp->nodeSelectionCombo = new CompleterLineEdit(nodeNames, nodeNames, false, this);
162 _imp->nodeSelectionCombo->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Input the name of a node in the current project."), NATRON_NAMESPACE::WhiteSpaceNormal) );
163 _imp->firstLineLayout->addWidget(_imp->nodeSelectionCombo);
164
165
166 _imp->nodeSelectionCombo->setFocus(Qt::PopupFocusReason);
167 QTimer::singleShot( 25, _imp->nodeSelectionCombo, SLOT(showCompleter()) );
168
169 _imp->knobSelectionCombo = new ComboBox(_imp->firstLine);
170 _imp->firstLineLayout->addWidget(_imp->knobSelectionCombo);
171
172 QObject::connect( _imp->nodeSelectionCombo, SIGNAL(itemCompletionChosen()), this, SLOT(onNodeComboEditingFinished()) );
173
174 _imp->firstLineLayout->addStretch();
175}
176
177LinkToKnobDialog::~LinkToKnobDialog()
178{

Callers

nothing calls this directly

Calls 14

convertFromPlainTextFunction · 0.85
addWidgetMethod · 0.80
getActiveNodesMethod · 0.80
getHolderMethod · 0.45
getKnobMethod · 0.45
getGroupMethod · 0.45
getNodeMethod · 0.45
getMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getLabelMethod · 0.45

Tested by

no test coverage detected