use instead QLineEdit::createStandardContextMenu().
Also, make sure contextMenuPolicy is not set to Qt::NoContextMenu.

regards