Check out these functions from QWidget class.

Qt Code:
  1. Qt::FocusPolicy focusPolicy () const
  2. void setFocusPolicy ( Qt::FocusPolicy policy )
To copy to clipboard, switch view to plain text mode 

Because by default a widget has Qt::NoFocus flag set.