void MyTextEdit::contextMenuEvent(QContextMenuEvent *event) {
QPoint mousePos = event->pos();
QTextCursor cursor = cursorForPosition(mousePos);
int blockNumber = cursor.blockNumber();
QMenu *menu = createStandardContextMenu();
menu->addAction(QString("Строка: %1").arg(blockNumber + 1));
menu->exec(event->globalPos());
delete menu;
}