我想把QPushbutton保存到vector中,但是在push_back的时候出错。如下:
QPushButton *mButton = new QPushButton(this);
// 保存到容器
m_vecButton.push_back(*mButton);
报错:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\vector(810): error C2248: “QPushButton::QPushButton” : 无法访问 private 成员(在“QPushButton”类中声明)
d:\QT4.3.4\include\QtGui\../../src\gui\widgets\qpushbutton.h(112) : 参见“QPushButton::QPushButton”的声明
d:\QT4.3.4\include\QtGui\../../src\gui\widgets\qpushbutton.h(57) : 参见“QPushButton”的声明
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\vector(809) : 编译类模板成员函数“void std::vector<_Ty>::_Insert_n(std::vector<_Ty>::iterator,std::vector<_Ty>::size_type,const _Ty &)”时
with
[
_Ty=QPushButton
]
d:\QTProject\PopoUp\mainwindow.h(59) : 参见对正在编译的类模板实例化“std::vector<_Ty>”的引用
with
[
_Ty=QPushButton
]