| 488 | } |
| 489 | |
| 490 | void Controller::registerWidget(const QString &name, AbstractWidget *abstractWidget) |
| 491 | { |
| 492 | if (d->allWidgets.contains(name)) |
| 493 | return; |
| 494 | |
| 495 | auto widget = static_cast<DWidget *>(abstractWidget->qWidget()); |
| 496 | if (!widget->parent()) |
| 497 | widget->setParent(d->mainWindow); |
| 498 | |
| 499 | WidgetInfo widgetInfo; |
| 500 | widgetInfo.name = name; |
| 501 | widgetInfo.setWidget(widget); |
| 502 | widgetInfo.icon = abstractWidget->getDisplayIcon(); |
| 503 | |
| 504 | d->allWidgets.insert(name, widgetInfo); |
| 505 | } |
| 506 | |
| 507 | void Controller::registerWidgetCreator(const QString &name, std::function<AbstractWidget *()> &widgetCreateFunc) |
| 508 | { |