#include <QObject>
#include <QApplication>
#include <QWidget>
#include <QPushButton>
#include <QLabel>
Q_OBJECT
public:
b->resize(100,30);
b->move(10,60);
l->resize(100,30);
l->move(10,10);
QObject::connect(b,
SIGNAL(clicked
()),
this,
SLOT(setl
()));
}
public slots:
void setl() {
l->setText("TEXT123");
}
private:
};
int main(int argc, char *argv[])
{
Class1 *c = new Class1();
c->move(300,100);
c->resize(120,100);
c->show();
return app.exec();
}
#include <QObject>
#include <QApplication>
#include <QWidget>
#include <QPushButton>
#include <QLabel>
class Class1 : public QWidget {
Q_OBJECT
public:
Class1(QWidget *p = 0) : QWidget(p) {
b = new QPushButton("Click",this);
l = new QLabel("Label",this);
b->resize(100,30);
b->move(10,60);
l->resize(100,30);
l->move(10,10);
QObject::connect(b,SIGNAL(clicked()),this,SLOT(setl()));
}
public slots:
void setl() {
l->setText("TEXT123");
}
private:
QPushButton *b;
QLabel *l;
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Class1 *c = new Class1();
c->move(300,100);
c->resize(120,100);
c->show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
and if i try to build the app i get this error:
:: error: collect2: ld returned 1 exit status
:: error: collect2: ld returned 1 exit status
To copy to clipboard, switch view to plain text mode
what is wrong?
Bookmarks