Delivery of a class user copy through the plugs



  • The parameters for further processing shall be removed from the flow to the main flow through the plugs. I've changed a lot of different information, and my head is pretty tired. Please help. Makes a mistake, tagged in the code:

    /action_user.cpp:25: error: use of deleted function 'Cargo::Cargo(const Cargo&)'
     case 1:  emit RegistrationSignal(route_signal, action_cargo); break;
                                                                ^
    

    #ifndef ACTION_USER_H
    #define ACTION_USER_H

    #include <QByteArray>
    #include "cargo.h"

    class Action_user : public QObject
    {
    Q_OBJECT
    public:
    explicit Action_user(QObject *parent = 0);
    void CommandSplit(QByteArray); // отправляет команды в private и action_cargo
    void Action_route(); //

    signals:
    void RegistrationSignal(int, Cargo);

    private slots:
    void RegistrationSlot();

    private:
    int route_signal;
    Cargo action_cargo; // рабочий экземпляр класса передачи данных для потока
    };
    #endif // ACTION_USER_H

    #ifndef DB_CONNECT_H
    #define DB_CONNECT_H

    #include <QObject>
    #include <QStringList>
    #include <action_user.h>

    class DB_connect : public QObject
    {
    Q_OBJECT
    public:
    explicit DB_connect(QObject *parent = 0);
    bool createConnection();

    signals:
    void createConnectionTrue();
    public slots:
    void AddDB(int, Cargo);
    };

    void registration (Cargo);

    #endif // DB_CONNECT_H

    //action_user.cpp
    #include <QStringList>
    #include <QString>
    #include <QSqlDatabase>
    #include <QSqlDriver>
    #include <QtSql/QtSql>
    #include "action_user.h"
    #include "db_connect.h"

    Action_user::Action_user(QObject *parent) : QObject(parent)
    {

    }

    void Action_user::CommandSplit(QByteArray)
    {
    route_signal = 0;
    // action_cargo.name_cargo; // рабочий экземпляр класса передачи данных для потока
    }

    void Action_user::Action_route()
    {
    DB_connect connectDB;
    connect(this, SIGNAL(RegistrationSignal(route_signal, action_cargo)), &connectDB, SLOT(AddDB(route_signal, action_cargo)));
    switch (route_signal) {

    // ОШИБКА ЗДЕСЬ

    case 1:  emit RegistrationSignal(route_signal, action_cargo); break; // ОШИБКА ЗДЕСЬ
    default:
      break;
    }
    

    }
    void Action_user::RegistrationSlot()
    {
    }

    //db_connect.cpp
    #include <QStringList>
    #include <QSqlDatabase>
    #include <QSqlError>
    #include <QtSql>
    #include <QDebug>
    #include "db_connect.h"
    #include "cargo.h"
    #include "action_user.h"

    DB_connect::DB_connect(QObject *parent) : QObject(parent)
    {

    }

    bool DB_connect::createConnection()
    {


    }

    void DB_connect::AddDB(int route, Cargo action_cargo)
    {
    switch (route) {
    case 1: registration(action_cargo); break;
    default:
    break;
    }
    }
    void registration (Cargo action_cargo)
    {


    }



  • error: no matching function for call to 'Action_user:RegistrationSignal(int, Cargo*..."
    case 1: emit RegistrationSignal(route_signal, action_cargo); break;

    action_cargo - it's an index, and the signal sends a copy of the class. Plus, macro-c http://doc.qt.io/qt-5/qmetatype.html#Q_DECLARE_METATYPE

    error: use of deleted function 'Cargo: emit RegistrationSignal(route_signal, action_cargo); break;

    A major object requires a copy design, it's removed. It needs to be defined or the indexes used.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2