MCPcopy Create free account
hub / github.com/KDE/kdevelop / createCustomElement

Method createCustomElement

kdevplatform/shell/mainwindow.cpp:180–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180QAction* MainWindow::createCustomElement(QWidget* parent, int index, const QDomElement& element)
181{
182 QAction* before = nullptr;
183 if (index > 0 && index < parent->actions().count())
184 before = parent->actions().at(index);
185
186 //KDevelop needs to ensure that separators defined as <Separator style="visible" />
187 //are always shown in the menubar. For those, we create special disabled actions
188 //instead of calling QMenuBar::addSeparator() because menubar separators are ignored
189 if (element.tagName().compare(QLatin1String("separator"), Qt::CaseInsensitive) == 0
190 && element.attribute(QStringLiteral("style")) == QLatin1String("visible")) {
191 if ( auto* bar = qobject_cast<QMenuBar*>( parent ) ) {
192 auto* separatorAction = new QAction(QStringLiteral("|"), this);
193 bar->insertAction( before, separatorAction );
194 separatorAction->setDisabled(true);
195 return separatorAction;
196 }
197 }
198
199 return KXMLGUIBuilder::createCustomElement(parent, index, element);
200}
201
202bool KDevelop::MainWindow::event( QEvent* ev )
203{

Callers

nothing calls this directly

Calls 6

attributeMethod · 0.80
insertActionMethod · 0.80
countMethod · 0.45
actionsMethod · 0.45
atMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected