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

Method createPart

kdevplatform/shell/partcontroller.cpp:163–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163KParts::Part* PartController::createPart( const QUrl & url, const QString& preferredPart )
164{
165 if (!url.isValid()) {
166 return nullptr;
167 }
168
169 qCDebug(SHELL) << "creating part with url" << url << "and pref part:" << preferredPart;
170 KParts::Part* part = createPart(mimeTypeForUrl(url), preferredPart);
171 if (!part) {
172 return nullptr;
173 }
174
175 // only ReadOnlyParts are supported by PartController
176 static_cast<KParts::ReadOnlyPart*>(part)->openUrl(url);
177
178 // restrict keyboard shortcuts to the KParts view
179 const auto actions = part->actionCollection()->actions();
180 for (auto* action : actions) {
181 if (action->shortcutContext() != Qt::WidgetShortcut) {
182 action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
183 }
184 }
185
186 return part;
187}
188
189void PartController::loadSettings( bool projectIsLoaded )
190{

Callers 1

createViewWidgetMethod · 0.45

Calls 5

mimeTypeForUrlFunction · 0.85
openUrlMethod · 0.80
isValidMethod · 0.45
actionsMethod · 0.45
actionCollectionMethod · 0.45

Tested by

no test coverage detected