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

Method createWidget

Gui/KnobGuiFile.cpp:94–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void
95KnobGuiFile::createWidget(QHBoxLayout* layout)
96{
97 KnobFilePtr knob = _knob.lock();
98 EffectInstance* holderIsEffect = dynamic_cast<EffectInstance*>( knob->getHolder() );
99
100 if ( holderIsEffect && holderIsEffect->isReader() && (knob->getName() == kOfxImageEffectFileParamName) ) {
101 TimeLinePtr timeline = getGui()->getApp()->getTimeLine();
102 QObject::connect( timeline.get(), SIGNAL(frameChanged(SequenceTime,int)), this, SLOT(onTimelineFrameChanged(SequenceTime,int)) );
103 }
104
105
106 _lineEdit = new LineEdit( layout->parentWidget() );
107 //layout->parentWidget()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
108 _lineEdit->setPlaceholderText( tr("File path...") );
109 _lineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
110
111 ///set the copy/link actions in the right click menu
112 enableRightClickMenu(_lineEdit, 0);
113
114 QObject::connect( _lineEdit, SIGNAL(editingFinished()), this, SLOT(onTextEdited()) );
115
116
117 _openFileButton = new Button( layout->parentWidget() );
118 _openFileButton->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
119 QPixmap pix;
120 appPTR->getIcon(NATRON_PIXMAP_OPEN_FILE, NATRON_MEDIUM_BUTTON_ICON_SIZE, &pix);
121 _openFileButton->setIcon( QIcon(pix) );
122 _openFileButton->setToolTip( toolTip() );
123 _openFileButton->setFocusPolicy(Qt::NoFocus); // exclude from tab focus
124 QObject::connect( _openFileButton, SIGNAL(clicked()), this, SLOT(onButtonClicked()) );
125
126 layout->addWidget(_lineEdit);
127 layout->addWidget(_openFileButton);
128
129 if ( knob && knob->getHolder() ) {
130 _reloadButton = new Button( layout->parentWidget() );
131 _reloadButton->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
132 _reloadButton->setFocusPolicy(Qt::NoFocus);
133 QPixmap pixRefresh;
134 appPTR->getIcon(NATRON_PIXMAP_VIEWER_REFRESH, NATRON_MEDIUM_BUTTON_ICON_SIZE, &pixRefresh);
135 _reloadButton->setIcon( QIcon(pixRefresh) );
136 _reloadButton->setToolTip( NATRON_NAMESPACE::convertFromPlainText(tr("Reload the file."), NATRON_NAMESPACE::WhiteSpaceNormal) );
137 QObject::connect( _reloadButton, SIGNAL(clicked()), this, SLOT(onReloadClicked()) );
138 layout->addWidget(_reloadButton);
139 }
140}
141
142void
143KnobGuiFile::onButtonClicked()

Callers

nothing calls this directly

Calls 15

getGuiFunction · 0.85
QIconClass · 0.85
toolTipFunction · 0.85
convertFromPlainTextFunction · 0.85
getNameMethod · 0.80
setIconMethod · 0.80
addWidgetMethod · 0.80
isMultiPathMethod · 0.80
lockMethod · 0.45
getHolderMethod · 0.45
isReaderMethod · 0.45
getTimeLineMethod · 0.45

Tested by

no test coverage detected