Проект:
QT += core widgets network
QT -= gui
CONFIG += c++11
TARGET = smoothing
TEMPLATE = app
SOURCES += main.cpp \
smoothing.cpp \
../../Nuclies/protocol.cpp \
../../Nuclies/handlers.cpp \
../../GetData/myclient.cpp
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
HEADERS += \
smoothing.h \
../../Nuclies/protocol.h \
../../Nuclies/handlers.h \
../../GetData/myclient.h
Заголовок:
#ifndef MYCLIENT_H
#define MYCLIENT_H
#include <QTimer>
#include <QQueue>
#include <QVector>
#include <QTextEdit>
#include <QTcpSocket>
#include <QEventLoop>
#include <QMainWindow>
#include "..\nuclies\protocol.h"
class MyClient : public QMainWindow, public SystemMember
{
Q_OBJECT
protected:
Message *lastMessage;
Message *toServer;
QTcpSocket *m_pTcpSocket;
private:
int port;
QTimer *wait;
QString host;
quint16 m_nNextBlockSize;
QEventLoop *toWait;
QVector<QQueue<Message>> recived;
public:
QTextEdit *m_ptxtInfo;
MyClient(const QString& strHost, int nPort, QWidget *parent = 0);
void sendToServer (Message *toSend);
Message readMessage (int messageType);
Message *from ();
Message *send ();
private slots:
void slotReadyRead ();
void slotError (QAbstractSocket::SocketError);
void slotConnected ();
void slotDestroyed ();
signals:
void give_time_periods_lists();
void time_periods();
void time_periods_given();
void time_periods_selected();
void time_periods_selected_given();
void give_parametrs_List();
void parametrs_List();
void par_list_selected();
void main_buffer_head ();
void operation_job ();
void handler_template ();
void main_buffer_template ();
void ready();
void data_frame ();
void send_whis_fixed_interval ();
void start_from_this_period ();
void start_from_operating_time();
void let_ready_state();
void pause();
void stop();
};
#endif // MYCLIENT_H
Исходник:
#include "myclient.h"
MyClient::MyClient (const QString& strHost, int nPort, QWidget *parent) :
QMainWindow ((QWidget *)parent, Qt::WindowTitleHint)
{
m_nNextBlockSize = 0;
host = strHost;
port = nPort;
m_pTcpSocket = new QTcpSocket(this);
m_pTcpSocket->connectToHost(strHost, nPort);
wait = new QTimer;
toWait = new QEventLoop;
connect(wait, SIGNAL(timeout()),
toWait, SLOT (quit()));
connect(m_pTcpSocket, SIGNAL(connected()), SLOT(slotConnected()));
connect(m_pTcpSocket, SIGNAL(readyRead()), SLOT(slotReadyRead()));
connect(m_pTcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT (slotError(QAbstractSocket::SocketError)));
QQueue<Message> temp;
for (int i = 0;i < Message::last_command;i++)
recived.append(temp);
m_ptxtInfo = new QTextEdit;
m_ptxtInfo->setReadOnly(true);
}
Выдает Segmentation в конструкторе QMainWindow. Работает в других сборках. Собирается без ощибок и предупреждений.
Чего я в упор не вижу?