i can't compile this QT program because I get this message about "multiple definition of `Dialog::status(QString const&)'"
There is some code: Dialog hader:
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
//class QCheckBox;
class QLabel;
class QLineEdit;
class QPushButton;
class Dialog : public QDialog
{
Q_OBJECT
public:
Dialog(QWidget *parent = 0);
signals:
void status(const QString &str);
private slots:
void on();
private:
QLabel *label;
QLineEdit *LineEdit;
QPushButton *button;
};
#endif // DIALOG_H
and implementation file:
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QHBoxLayout>
#include "dialog.h"
Dialog::Dialog(QWidget *parent) : QDialog(parent)
{
label = new QLabel("Ne label");
LineEdit = new QLineEdit();
button = new QPushButton("Push me");
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget(label);
layout->addWidget(LineEdit);
layout->addWidget(button);
setLayout(layout);
setWindowTitle("Dialog name");
connect(button, SIGNAL(clicked()), this, SLOT(on()));
}
void Dialog::on()
{
label->setStyleSheet("QLabel { background-color : black; color : white; }");
}
void Dialog::status(const QString &str)
{
}
project file looks fine:
QT += gui declarative
SOURCES += \
main.cpp \
dialog.cpp
HEADERS += \
dialog.h
Thanks for your help.