why do I need to claim this class in h file?

  • My h file is like this:

    • #ifndef WINDOW_H
      #define WINDOW_H
      #include <QMainWindow>
      #include <QUrl>
      #include <QWebElement>
      class QTreeWidgetItem; //====================================> why do I need this line?
      #include "ui_window.h"
      class Window : public QMainWindow, private Ui::Window
      Window(QWidget *parent = 0);
      void setUrl(const QUrl &url);
      public slots:
      void on_webView_loadFinished();
      void examineChildElements(const QWebElement &parentElement,
      QTreeWidgetItem *parentItem);

  • It's a forward declaration. (a bit more about it here and here

  • @David.G Thank you!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.