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

Method newArea

kdevplatform/shell/areadisplay.cpp:55–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void AreaDisplay::newArea(Sublime::Area* area)
56{
57 if(m_button->menu())
58 m_button->menu()->deleteLater();
59
60 Sublime::Area* currentArea = m_mainWindow->area();
61
62 m_button->setText(currentArea->title());
63 m_button->setIcon(QIcon::fromTheme(currentArea->iconName()));
64
65 auto* m = new QMenu(m_button);
66 m->addActions(area->actions());
67 if (currentArea->objectName() != QLatin1String("code")) {
68 if(!m->actions().isEmpty())
69 m->addSeparator();
70 m->addAction(QIcon::fromTheme(QStringLiteral("document-edit")), i18nc("@action:inmenu", "Back to Code"),
71 QKeySequence(Qt::AltModifier | Qt::Key_Backspace), this, &AreaDisplay::backToCode);
72 }
73 m_button->setMenu(m);
74
75 //remove the additional widgets we might have added for the last area
76 auto* l = qobject_cast<QBoxLayout*>(layout());
77 if(l->count()>=4) {
78 QLayoutItem* item = l->takeAt(0);
79 delete item->widget();
80 delete item;
81 }
82 QWidget* w = Core::self()->workingSetControllerInternal()->createSetManagerWidget(m_mainWindow, area);
83 w->installEventFilter(this);
84 m_separator->setVisible(w->isVisible());
85 l->insertWidget(0, w);
86}
87
88bool AreaDisplay::eventFilter(QObject* obj, QEvent* event)
89{

Callers

nothing calls this directly

Calls 14

menuMethod · 0.80
setIconMethod · 0.80
areaMethod · 0.45
setTextMethod · 0.45
titleMethod · 0.45
iconNameMethod · 0.45
actionsMethod · 0.45
isEmptyMethod · 0.45
addActionMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected