0

I have create a SLOT/SIGNAL but I do not succeed to build. I do not really understand why ?

My header is :

class MyTreeWidget : public QTreeWidget
{
    Q_OBJECT
public:
    MyTreeWidget(MyDeviceMngr& device, PulsMainUI& parent);
    ~MyTreeWidget();

private slots:
    void onCollapsed(QTreeWidgetItem*);
    void onPulsTreeWidgetItemExpanded(QTreeWidgetItem*);
    void onDeleteAction();
    void onAddFolderActionTree();
    void onTreeItemChanged(QTreeWidgetItem* item);

};

My C++ file is

MyTreeWidget::MyTreeWidget(MyDeviceMngr& device, MainUI& parent) :
    m_device(device), w_parent(parent)
{
    TreeBox = new PulsBox;
    setSortingEnabled(true);
    setColumnWidth(0, 400);
    setExpandsOnDoubleClick(true);

    setAlternatingRowColors(false);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::ExtendedSelection);

    connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)),
                     this, SLOT(onPulsTreeWidgetItemExpanded(QTreeWidgetItem*)));
    connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)),
                     this, SLOT(onCollapsed(QTreeWidgetItem*)));
}

What is strange is that onCollapsed is not found but onPulsTreeWidgetItemExpanded is found !!!!

here the issue:

Undefined symbols for architecture x86_64:
  "MyTreeWidget::onCollapsed(QTreeWidgetItem*)", referenced from:
      MyTreeWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) in moc_mytreewidget.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [connect.app/Contents/MacOS/connect] Error 1
23:09:20: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project connect (kit: Clone of Clone of Desktop Qt 5.4.2 clang 64bits
When executing step "Make"
Seb
  • 2,929
  • 4
  • 30
  • 73
  • 1
    Which version of Qt do you've? ItemExpanded seems to be an obsolete signal. – dfranca Mar 10 '15 at 06:24
  • @Danielfranca I'm using Qt5.4 – Seb Mar 10 '15 at 06:32
  • @Drop the issue complains about onCollapsed. and not I have implemented it – Seb Mar 10 '15 at 06:34
  • But your buid process is pointing to Qt5 Error while building/deploying project connect (kit: Clone of Clone of Desktop Qt 5.4.2 clang 64bits – dfranca Mar 10 '15 at 06:48
  • Have you tried to run qmake and the build? – tomvodi Mar 10 '15 at 07:19
  • 1
    not so sure if onPlusTreeWidgetItemExpanded is found ... it stops after onCollpased is not found which is defined before onPlusTreeWidgetItemExpanded ... care to show the implementation of your slots? – codencandy Mar 10 '15 at 07:44
  • Thanks for all your help. The issue was coming from Qt Creator. make clean seems not cleaning correctly. I had to manually removed the build location folder – Seb Mar 10 '15 at 08:07

0 Answers0