Помогите разобраться
почему не работает
C++ (Qt)
Station::Station(CommonElement *parent):
CommonElement(parent)
{
layer0 = new CLayer0(this); //программа вылетает
}
void Station::setRS485(QString name, BaudRateType baud, ParityType parity)
{
//layer0 = new CLayer0(this); // то все нормально
layer0->init_port(name,baud,parity);
connect(layer0,SIGNAL(showData(QByteArray)),this,SIGNAL(sg_showData(QByteArray)));
}
C++ (Qt)
class CLayer0: public QObject
{
Q_OBJECT
Q_PROPERTY (qint64 bytesSent READ getBytesSent WRITE setBytesSent)
Q_PROPERTY (qint64 bytesReceived READ getBytesReceived WRITE setBytesreceived)
Q_PROPERTY (bool connected READ getConnected WRITE setConnected)
public:
explicit CLayer0(QObject* parent = 0);
virtual ~CLayer0();
public:
void init_port(QString,BaudRateType,ParityType);
qint64 getBytesSent();
void setBytesSent(qint64 &);
qint64 getBytesReceived();
void setBytesreceived(qint64 &);
bool getConnected ();
void setConnected(bool );
qint64 readData(char * data, qint64 maxSize);
qint64 writeData(const char * data, qint64 maxSize);
Q_SIGNALS:
void showData(QByteArray);
public Q_SLOTS:
void received();
public:
QextSerialPort *port;
private:
qint64 bytesSent;
qint64 bytesReceived;
bool connected;
};