Hi,

First of all I need to say that I'm very new to Qt and C++ so there is a lot I still don't understand with the language.
Anyhow I'm trying to insert a syntax highlighter for QTextEdit and it works if I follow this tutorial:
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QApplication app(argc, argv);
  4. QTextEdit editor;
  5. HtmlSyntaxHighlighter highlighter(editor.document()); // my subclass
  6. editor.show();
  7. return app.exec();
  8. }
To copy to clipboard, switch view to plain text mode 

However I want to apply this highlighter to my QTextEdit in my QTagWidget and the only way I can find to insert a QTextEdit is like this:
Qt Code:
  1. QTextEdit *myTextEdit = new QTextEdit();
  2. HtmlSyntaxHighlighter highlighter(myTextEdit->document()); // doesn't do anything
  3. myTabWidget->addTab(myTextEdit, tr("foobar"));
To copy to clipboard, switch view to plain text mode 

So whats the difference between between these two declarations?
Qt Code:
  1. QTextEdit *myTextEdit = new QTextEdit(); // now I need to use: myTextEdit->publicFunction()
  2.  
  3. QTextEdit editor; // now I need to use: myTextEdit.publicFunction()
To copy to clipboard, switch view to plain text mode 

And why doesn't the the syntax highlighter work?

Thanks in advance.