Uploaded image for project: 'Qt Solutions'
  1. Qt Solutions
  2. QTSOLBUG-105

Subclassing QtTreePropertyBrowser causes linker error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • Some Release
    • Property Editor
    • None
    • MacBook Pro
      Windows Vista
      Visual Studio 2008
      QtCreator 1.2

    Description

      When I subclass QtPropertyTreeBrowser and add the Q_OBJECT macro, I get the following linker error:

      moc_mainwindow.obj:-1: error: unresolved external symbol "public: static struct QMetaObject const QtTreePropertyBrowser::staticMetaObject" (?staticMetaObject@QtTreePropertyBrowser@@2UQMetaObject@@B)

      I need to do this so I can add a slot that gets connected to, for example, the QtBoolPropertyManager::valueChanged() signal.

      To reproduce:

      1. Start a new GUI application in Qt Creator.

      2. In MainWindow.h, add the following class:

      #include <QtTreePropertyBrowser>
      class MyPropertyBrowser : public QtTreePropertyBrowser
      {
      Q_OBJECT

      public:
      MyPropertyBrowser(QWidget* parent = 0) : QtTreePropertyBrowser(parent) {}
      ~MyPropertyBrowser() {}
      };

      3. In MainWindow.cpp, edit the constructor:

      MainWindow::MainWindow(QWidget *parent)
      : QMainWindow(parent), ui(new Ui::MainWindow)
      {
      ui->setupUi(this);
      MyPropertyBrowser* browser = new MyPropertyBrowser(this);
      }

      4. Update the project file:

      LIBS += -LPropertyEditor\lib -lQtSolutions_PropertyBrowser-2.5d
      INCLUDEPATH += PropertyEditor\src

      5. Build.

      If you comment out Q_OBJECT, the linker error doesn't occur.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            monsen Marius Bugge Monsen
            rsibley77 Robin Sibley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes