| 178 | } |
| 179 | |
| 180 | QAction* 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 | |
| 202 | bool KDevelop::MainWindow::event( QEvent* ev ) |
| 203 | { |