The QStyleOptionViewItem parameter contains all required information.
Qt Code:
  1. if (opt.state & QStyle::State_Selected)
  2. ...
  3.  
  4. if (opt.state & QStyle::State_HasFocus)
  5. ...
To copy to clipboard, switch view to plain text mode 
etc.