Your code seems fine. If you don't get the effect you want, that's probably because you might be drawing outside rect. And your loop seems incorrect. I'd implement it like so:
Qt Code:
  1. int y=rect.top();
  2. foreach(QString event, events){
  3. QRect br;
  4. painter->drawText(QRect(rect.left(), y, rect.width(), rect.height()-y), ..., &br);
  5. y+=br.height()+1;
  6. }
To copy to clipboard, switch view to plain text mode