【发布时间】:2016-02-13 16:58:13
【问题描述】:
我有Ubuntu 14.04,C++,QT,
我将extend 班级QPushbutton,我将创建一个新的Slot
我愿意:
#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();
}
问题是:
/home/user/untitled6/sd.cpp:18:错误:未定义对`vtable的引用 对于机器人'
如何解决问题???
我的 file.pro 是:
SOURCES += \
sd.cpp
QT += widgets
FORMS += \
form.ui
【问题讨论】: