mainWindow里声明一个指针:
mainwindow.h
public:
QVector<xxxxxType> *xxxxData(){return &这个vector};
dialog.cpp
#include "mainwindow.h"
void xxxxxx槽()
{
mainwindow *w = (mainwindow*)parentWidget();
QVector<xxxxxType> *xxxxData = w->xxxxData();
xxxxData->就可以使用这个vector了。
}
注意:使用这个dialog的时候要传mainwindow指针进去,Dialog(this); dlg.exe();