MCPcopy Create free account
hub / github.com/KDE/labplot / loadMenu

Method loadMenu

src/frontend/TemplateHandler.cpp:266–282  ·  view source on GitHub ↗

############################################################################## ################################## Slots #################################### ##############################################################################

Source from the content-addressed store, hash-verified

264// ################################## Slots ####################################
265// ##############################################################################
266void TemplateHandler::loadMenu() {
267 QMenu menu(this);
268 menu.addSection(i18n("Load From Template"));
269
270 auto list = QDir(m_dirName + m_className).entryList();
271 list.removeAll(QLatin1String("."));
272 list.removeAll(QLatin1String(".."));
273 for (int i = 0; i < list.size(); ++i) {
274 QFileInfo fileinfo(list.at(i));
275 auto* action = menu.addAction(QIcon::fromTheme(QLatin1String("document-edit")), fileinfo.fileName());
276 action->setData(fileinfo.fileName());
277 }
278 connect(&menu, &QMenu::triggered, this, &TemplateHandler::loadMenuSelected);
279
280 QPoint pos(-menu.sizeHint().width() + m_tbLoad->width(), -menu.sizeHint().height());
281 menu.exec(m_tbLoad->mapToGlobal(pos));
282}
283
284void TemplateHandler::loadMenuSelected(QAction* action) {
285 QString configFile = m_dirName + m_className + QLatin1Char('/') + action->data().toString();

Callers

nothing calls this directly

Calls 8

removeAllMethod · 0.80
heightMethod · 0.80
execMethod · 0.80
sizeMethod · 0.45
fileNameMethod · 0.45
setDataMethod · 0.45
widthMethod · 0.45
sizeHintMethod · 0.45

Tested by

no test coverage detected