MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / registerWidgetToMode

Method registerWidgetToMode

src/plugins/core/uicontroller/controller.cpp:452–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452void Controller::registerWidgetToMode(const QString &name, AbstractWidget *abstractWidget, const QString &mode, Position pos, bool replace, bool isVisible)
453{
454 if (!d->validModeList.contains(mode)) {
455 qWarning() << "mode can only choose CM_RECENT / CM_EDIT / CM_DEBUG";
456 return;
457 }
458
459 if (d->allWidgets.contains(name)) {
460 auto &info = d->allWidgets[name];
461 if (!d->modeInfo[mode].contains(name)) {
462 if (info.defaultPos != pos)
463 qWarning() << "widget named: " << name << "has registed to another position";
464 d->modeInfo[mode].append(name);
465 } else {
466 qWarning() << "Widget named: " << name << "has alreay registed";
467 }
468 return;
469 }
470
471 DWidget *qWidget = static_cast<DWidget *>(abstractWidget->qWidget());
472 if (!qWidget->parent())
473 qWidget->setParent(d->mainWindow);
474
475 WidgetInfo widgetInfo;
476 widgetInfo.name = name;
477 widgetInfo.defaultPos = pos;
478 widgetInfo.replace = replace;
479 widgetInfo.setWidget(qWidget);
480 widgetInfo.defaultVisible = isVisible;
481 widgetInfo.icon = abstractWidget->getDisplayIcon();
482
483 createDockWidget(widgetInfo);
484 d->mainWindow->hideWidget(name);
485
486 d->allWidgets.insert(name, widgetInfo);
487 d->modeInfo[mode].append(name);
488}
489
490void Controller::registerWidget(const QString &name, AbstractWidget *abstractWidget)
491{

Callers 5

startMethod · 0.80
addRecentOpenWidgetMethod · 0.80
startMethod · 0.80
initWindowServiceMethod · 0.80
registerToDockMethod · 0.80

Calls 8

qWidgetMethod · 0.80
getDisplayIconMethod · 0.80
insertMethod · 0.80
containsMethod · 0.45
appendMethod · 0.45
parentMethod · 0.45
setWidgetMethod · 0.45
hideWidgetMethod · 0.45

Tested by

no test coverage detected