I want to have a simple ui loader and the posibility to connect signals from ui to slots stored in MyClass. (wrun)
For example, I would can connect them with this code .
QList<QPushButton *> pbto = formWidget->findChildren<QPushButton *>();
for (int i=0;i<pbto.count();i++)
{
connect(pbto.at(i), SIGNAL(clicked()), this, SLOT(button_click));
}
QList<QPushButton *> pbto = formWidget->findChildren<QPushButton *>();
for (int i=0;i<pbto.count();i++)
{
connect(pbto.at(i), SIGNAL(clicked()), this, SLOT(button_click));
}
To copy to clipboard, switch view to plain text mode
To do this :
1.- I have to use Q_Object macro
2.- I have to subclass Qobject
When I compile I have get errors : 'undefined reference to `vtable for wrun' ' at the lines (in cpp) where is placed :
wrun.cpp:11: undefined reference to `vtable for wrun'
wrun.cpp:11: undefined reference to `vtable for wrun'
debug/wrun.o: In function `~wrun':
wrun.cpp:13: undefined reference to `vtable for wrun'
wrun.cpp:13: undefined reference to `vtable for wrun'
wrun.cpp:13: undefined reference to `vtable for wrun'
Can anyone help me ?
wrun.h
{
Q_OBJECT
public:
wrun();
~wrun();
....
class wrun : public QObject
{
Q_OBJECT
public:
wrun();
~wrun();
....
To copy to clipboard, switch view to plain text mode
wrun.cpp
#include "wrun.h"
#include <QUiLoader>
wrun::wrun(){}
wrun::~wrun(){}
....
#include "wrun.h"
#include <QUiLoader>
wrun::wrun(){}
wrun::~wrun(){}
....
To copy to clipboard, switch view to plain text mode
Any idea ?
Bookmarks