i have Ubuntu 14.04
, C++
, QT
,
I will extend
the class QPushbutton
, and i will to make a new Slot
I do :
#include<QApplication>
#include<QDialog>
#include<QLabel>
#include <X11/Xlib.h>
#include<QVBoxLayout>
#include<iostream>
#include<QWidget>
#include<QPushButton>
#include <QThread>
#include <QGridLayout>
#include <QSplitter>
#include<QAbstractButton>
using namespace std;
class bot : public QPushButton {
Q_OBJECT;
public slots:
void txt() {
setText("hi");
}
};
int main(int a , char * b[])
{
QApplication application(a,b);
QPushButton *button = new QPushButton();
bot *l = new bot();
button->setFixedSize(100,100);
l->setText("sssssssssssssss");
QVBoxLayout *ll = new QVBoxLayout;
ll->addWidget(l);
ll->addWidget(button);
QWidget x ;
x.setLayout(ll);
x.show();
QObject::connect(button, SIGNAL(clicked()), l , SLOT( txt()) );
return application.exec();
}
The Problem is :
/home/user/untitled6/sd.cpp:18: error: undefined reference to `vtable for bot'
how resolve the problem ???
my file.pro is :
SOURCES += \
sd.cpp
QT += widgets
FORMS += \
form.ui