title: QTextDocument::contentsChanged doesn't seem to be triggered on formatting changes
body: <p>I would like to do certain updates when the text contents change or font or alignment change on QGraphicsTextItem.</p>
  
  <p>So I connected <a href="http://doc.qt.io/qt-4.8/qtextdocument.html#contentsChange" rel="nofollow">QTextDocument::contentsChanged()</a> to a slot that does the update.  </p>
  
  <blockquote>
    <p>This signal is emitted whenever the document's content changes; for
    example, when text is inserted or deleted, <strong>or when formatting is
    applied</strong>.</p>
  </blockquote>
  
  <p>The signal gets hit when I change the text - but setting text formatting or alignment doesn't seem to affect it. </p>
  
  <pre><code>.h
  class MyTextItem : public QGraphicsTextItem
  {
  Q_OBJECT
  public:
      MyTextItem();
      ~MyTextItem() {}
      void setItemFont(QFont f);
      void setItemAlign(Qt::Alignment a);
  private slots:
      void updateItemOnContentsChanged();
  private:
      void updateTextOnPropertyChanges();
  };
  
  .cpp
  MyTextItem::MyTextItem()
  {
      setTextInteractionFlags(Qt::TextEditorInteraction);
      connect(document(), SIGNAL(contentsChanged()), this, SLOT(updateItemOnContentsChanged()));
  }
  void MyTextItem::setItemFont(QFont f)
  {
      setFont(f);
  }
  void MyTextItem::setItemAlign(Qt::Alignment a)
  {
      QTextDocument *_document = document();
      QTextOption _option = _document-&gt;defaultTextOption();
      _option.setAlignment(a);
      _document-&gt;setDefaultTextOption(_option);
      setDocument(_document);
  }
  void MyTextItem::updateItemOnContentsChanged()
  {
      updateTextOnPropertyChanges();
  }
  void MyTextItem::updateTextOnPropertyChanges()
  {
      qDebug("changing something");
  }
  
  main.cpp
  int main(int argc, char *argv[])
  {
      QApplication app(argc, argv);
      QGraphicsScene s;
      QGraphicsView view(&amp;s);
      s.setSceneRect(-50, -50, 500, 500);
      view.show();
      MyTextItem* t = new MyTextItem();
      t-&gt;setPlainText("Hello World !");   // Note this triggers update
      s.addItem(t);
      qDebug("1");
      qDebug() &lt;&lt; t-&gt;font().family();
      t-&gt;setItemFont(QFont("Arial"));  // or t-&gt;setFont(QFont("Arial"));
      qDebug() &lt;&lt; t-&gt;font().family();
      qDebug("2");
      t-&gt;setItemAlign(Qt::AlignRight);
      qDebug("3");
      return app.exec();
  }
  </code></pre>
  
  <p>My debug output:</p>
  
  <pre><code>changing something
  1
  "MS Shell Dlg 2" // so the font is changing - yet no signal
  "Arial"
  2
  3
  </code></pre>
  
  <p>(and if I type in the item on the scene I get <code>changing something</code> as well)<br>
  But no <code>changing something</code> after the <code>setItemFont()</code> or <code>setItemAlign()</code>.  </p>
  
  <p>So changing text affects it - but changing font or alignment doesn't...</p>
  
  <p>Do I understand wrong the part I set bold in the signal description ?<br>
  Why do I not see <code>changing something</code> after changing font or alignment...</p>
  
  <p>I also wonder - does my changing the <code>document()</code> when I set alignment or wrap or other document properties affect the connect ? (it doesn't seem to...)</p>
  
  <p>(Note I wrote the <code>setItem*</code> functions to be able to call the <code>updateTextOnPropertyChanges()</code> function - so I can make things work the way I need - but would be great if I didn't need them and just use the Qt ones, if the signal worked as I thought it would)</p>