MCPcopy Create free account
hub / github.com/TeXworks/texworks / updateEngineList

Method updateEngineList

src/TeXDocumentWindow.cpp:1573–1601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1571}
1572
1573void TeXDocumentWindow::updateEngineList()
1574{
1575 engine->disconnect(this);
1576 while (menuRun->actions().count() > 2)
1577 menuRun->removeAction(menuRun->actions().last());
1578 while (engineActions->actions().count() > 0)
1579 engineActions->removeAction(engineActions->actions().last());
1580
1581 QStandardItemModel * model = qobject_cast<QStandardItemModel*>(engine->model());
1582 Q_ASSERT(model);
1583 model->clear();
1584 foreach (Engine e, TWApp::instance()->getEngineList()) {
1585 QAction *newAction = new QAction(e.name(), engineActions);
1586 newAction->setCheckable(true);
1587 bool available{e.isAvailable()};
1588 newAction->setEnabled(available);
1589 newAction->setObjectName(QStringLiteral("actionTypesetTool%1").arg(e.name()));
1590 menuRun->addAction(newAction);
1591 QStandardItem * item = new QStandardItem(e.name());
1592 item->setFlags(Qt::ItemIsSelectable | (available ? Qt::ItemIsEnabled : Qt::NoItemFlags));
1593 model->appendRow(item);
1594 }
1595 connect(engine, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (TeXDocumentWindow::*)(int)>(&TeXDocumentWindow::selectedEngine));
1596 int index = engine->findText(engineName, Qt::MatchFixedString);
1597 if (index < 0)
1598 index = engine->findText(TWApp::instance()->getDefaultEngine().name(), Qt::MatchFixedString);
1599 if (index >= 0)
1600 engine->setCurrentIndex(index);
1601}
1602
1603void TeXDocumentWindow::selectedEngine(QAction* engineAction) // sent by actions in menubar menu; update toolbar combo box
1604{

Callers

nothing calls this directly

Calls 3

getDefaultEngineMethod · 0.80
clearMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected