void Editor::ShowEditorMenu(const QPoint point) { if (GetRefenceForWordUnderCursor() != "") { int line, index; getCursorPosition(&line, &index); QString word = wordAtLineIndex(line, index);// wordAtPoint(mapToGlobal(QCursor::pos())); actionHelpWithThis->setText("Help with this code: " + word); actionHelpWithThis->setVisible(true); } else { actionHelpWithThis->setText("Help with this code"); actionHelpWithThis->setVisible(false); } context->popup(mapToGlobal(point)); }
QString Editor::GetRefenceForWordUnderCursor(void) { int line, index; getCursorPosition(&line, &index); QString word = wordAtLineIndex(line, index);// wordAtPoint(mapToGlobal(QCursor::pos())); if (word != "") { QString fileName = (word + ".html").toUpper(); QDir dir(config.arduinoInstall + "/reference"); if (dir.entryList().contains(fileName, Qt::CaseInsensitive)) { for (int i=0; i < dir.entryList().count(); i++) { if (dir.entryList().at(i).toUpper() == fileName) { return config.arduinoInstall + "/reference/" + dir.entryList().at(i); } } } } return ""; }
QString QScintillaWidget::wordAt(const int &pLine, const int &pColumn) const { // Return the current word, if any return wordAtLineIndex(pLine, pColumn); }