DialogWindow::button_pressed_slot(){ <что-то делаем> ... передаем_в_слот1_mainWindow(вектор*);}
mainWindow::слот1(вектор *){....}
emit передаем_в_слот1_mainWindow(вектор*);
namespace Ui {class addWindow;}class addWindow : public QWidget{ Q_OBJECTpublic: explicit addWindow(QWidget *parent = 0); ~addWindow();public slots: void on_okButton_clicked();[code]signals: void sendDetals(QVector<QString>* vec);private: Ui::addWindow *ui;};
#include "addwindow.h"#include "ui_addwindow.h"addWindow::addWindow(QWidget *parent) : QWidget(parent), ui(new Ui::addWindow){ ui->setupUi(this);}void addWindow::on_okButton_clicked(){ QVector<QString> *vect = new QVector<QString>; emit sendDetals(vect);}
#include "addwindow.h"namespace Ui {class MainWindow;}class MainWindow : public QMainWindow{ Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow();public slots: void add_slot(QVector<QString> *vec);public: Ui::MainWindow *ui;private: addWindow *addw;};
#include "mainwindow.h"#include "ui_mainwindow.h"#include "addwindow.h"MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); connect(addw,SIGNAL(sendDetals(QVector<QString>*)),this,SLOT(add_slot(QVector<QString>*)));}void MainWindow::on_addButton_clicked(){ addWindow *addw = new addWindow(); addw->show();}void MainWindow::add_slot(QVector<QString> *vec){ qDebug() << "ура!";}
addWindow *dialog = qobject_cast<addWindow *>(sender());
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow){ ui->setupUi(this); connect(addw,SIGNAL(sendDetals(QVector<QString>*)),this,SLOT(add_slot(QVector<QString>*)));}void MainWindow::on_addButton_clicked(){ addWindow *addw= new addWindow(); addw->show();}