I've got textedit and i want display menu so i do:
Qt Code:
{ if (event->button() == Qt::RightButton) { if (this->textCursor().selectedText().isEmpty() == true) // if nothing selected { if (!cursor.selectedText().isEmpty()) { int iPos = cursor.position() - cursor.block().position(); // cursor.positionInBlock() // channel if (strText.at(0) == '#') { ... ... menu->popup(mapToGlobal(event->pos())); } // nick if ((iPos > 11) && (iPos < 11+2+strWord.length())) { ... ... menu->popup(mapToGlobal(event->pos())); } } } } } }To copy to clipboard, switch view to plain text mode
this code is working good but sometimes vertical scroll bar stops, and moving it to bottom by mouse don't work - because after adding next line of text it back to "saved"? position ...
maybe I forget to add something ?
Bookmarks