MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / highlightPath

Method highlightPath

MiniZincIDE/mainwindow.cpp:1838–1877  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1836}
1837
1838void MainWindow::highlightPath(QString& path, int index) {
1839 // Build list of blocks to be highlighted
1840 QVector<QStringList> locs = getBlocksFromPath(path);
1841 if(locs.size() == 0) return;
1842 QVector<CodeEditor*> ces = collectCodeEditors(locs);
1843 if(ces.size() != locs.size()) return;
1844
1845 int b = Qt::red;
1846 int t = Qt::yellow;
1847 QColor colour = static_cast<Qt::GlobalColor>((index % (t-b)) + b);
1848
1849 int strans = 25;
1850 int trans = strans;
1851 int tstep = (250-strans) / locs.size();
1852
1853 for(int p = 0; p < locs.size(); p++) {
1854 QStringList& elements = locs[p];
1855 CodeEditor* ce = ces[p];
1856 if (!ce) {
1857 continue;
1858 }
1859 bool ok;
1860 int sl = elements[1].toInt(&ok);
1861 int sc = elements[2].toInt(&ok);
1862 int el = elements[3].toInt(&ok);
1863 int ec = elements[4].toInt(&ok);
1864 if(elements.size() == 6)
1865 trans = elements[5].toInt(&ok);
1866 if (ok) {
1867 colour.setAlpha(trans);
1868 trans = trans < 250 ? trans+tstep : strans;
1869
1870 Highlighter& hl = ce->getHighlighter();
1871 hl.addFixedBg(sl,sc,el,ec,colour,path);
1872 hl.rehighlight();
1873
1874 ce->setTextCursor(QTextCursor(ce->document()->findBlockByLineNumber(el)));
1875 }
1876 }
1877}
1878
1879void MainWindow::anchorClicked(const QUrl & anUrl)
1880{

Callers

nothing calls this directly

Calls 3

getBlocksFromPathFunction · 0.85
addFixedBgMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected