I'm porting a very simple application from Qt3.1 to Qt4. I read a line from a socket and then pop up a message window to display the text. The problem is that lines are automatically wrapped even if I surround the text with <nobr> tags. Here's a code fragment:

Qt Code:
  1. QString buffer=... // get the string text from our data source
  2.  
  3. buffer=buffer.simplified(); // chop and compress whitespace
  4. QMessageBox qmb("QtAlert", "<html><font size=\"7\"><nobr>"+buffer+"</nobr></font></html>", QMessageBox::Information, QMessageBox::Ok|QMessageBox::Default, 0, 0);
  5.  
  6. // try to expand horizontally and not vertically
  7. qmb.setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Minimum));
  8. qmb.setTextFormat(Qt::RichText);
  9.  
  10. // try to open our window on top
  11. Qt::WindowFlags wflags=qmb.windowFlags();
  12. qmb.setWindowFlags(wflags|Qt::WindowStaysOnTopHint);
  13. qmb.exec();
To copy to clipboard, switch view to plain text mode 

Anything over about 12 characters gets wrapped in the middle of a word despite the <nobr> tag. For example, the string 'incontrovertibly' displays as:

incontrovert
ibly

I want the message box to expand horizontally to fit a line until it encounters an explicit <br />. What am I doing wrong?