I have a matter with signal/slots in Qt 5.6.0
When I try to compile, I get the following error: I googled it and I found out when I use qmake(which is the case I believe) then I have to do some moc tricking, however as a compelte Qt beginner I did not find the appropriate solution.
Error output:
loadtexview.obj:-1: error: LNK2019: unresolved external symbol "public: void __cdecl LoadTexView::TexSend(class QPixmap)" (?TexSend@LoadTexView@@QEAAXVQPixmap@@@Z) referenced in function "public: virtual void __cdecl LoadTexView::paintGL(void)" (?paintGL@LoadTexView@@UEAAXXZ)
loadtexview.h:
#ifndef LOADTEXVIEW_H
#define LOADTEXVIEW_H
#include <QtOpenGL/QtOpenGL>
class LoadTexView : public QGLWidget
{
public:
LoadTexView(QWidget *parent = 0);
void paintGL();
signals:
void TexSend(QPixmap sending);
};
#endif // LOADTEXVIEW_H
loadtex.cpp
...
void LoadTexView::paintGL()
{
int w1 = width();
int h1 = height();
int w2,h2;
float r1 = (float) w1 / (float) h1;
float r2 = 1;
w2 = w1;
h2 = (float) w2 / r2;
if(h2 > h1)
{
h2 = h1;
w2 = (float) h2 * r2;
}
QPixmap tex = QPixmap("C:\\Users\\Gabor\\OneDrive\\Documents\\TexGen\\TexGen\\road.bmp");
emit TexSend(tex);
...
connecting the signal and slot in mainwindow.cpp:
myLoadView = new LoadTexView();
myGenView = new GenTexView();
QHBoxLayout *TWrapper = new QHBoxLayout;
TWrapper -> addWidget(myLoadView);
ui->LoadedTexture->setLayout(TWrapper);
QObject::connect(myLoadView, SIGNAL(TexSend(QPixmap)),
myGenView, SLOT(gotTexture(QPixmap)));
Anyone has an idea how do I solve this? I believe it's just a moc configuration, however, I have no idea how to solve it. Everything else seems fine to me.