director->setOpenGLView(glview);
_mainWindow.setGLView(glview->getGLWidget());
_mainWindow.show();
...... }
<br>
4. Modify your QT MainWindow class (here is CCGEditor):<br>
CCGEditor.h<br>
class CCGEditor : public QMainWindow { Q_OBJECT
public: CCGEditor(QWidget *parent = 0); ~CCGEditor() {}
void setGLView(QWidget *glWidget);
protected: void closeEvent(QCloseEvent *);
private: Ui::CCGEditorClass ui; AppDelegate *_appDelegate; QWidget *_glWidget; };
<br>
CCGEditor.cpp<br>
CCGEditor::CCGEditor(QWidget *parent) : QMainWindow(parent), _appDelegate(NULL), _glWidget(NULL) { ui.setupUi(this); }
void CCGEditor::closeEvent(QCloseEvent *) { cocos2d::Director::getInstance()->end(); qApp->quit(); }
void CCGEditor::setGLView(QWidget *glWidget) { _glWidget = glWidget;
if (_glWidget)
{
ui.SceneWidget->setWidget(_glWidget);
setCentralWidget(ui.SceneWidget);
}
}
<br>
5. modify the main function in this way:<br>
int main(int argc, char *argv[]) { AppDelegate app(argc, argv); return cocos2d::CCQApplication::getInstance()->run(); }
<br>
6. do not forget the header files_(:зゝ∠)_<br>
<br>
See my blog for detail:<br>
http://www.cnblogs.com/marisa/p/4141862.html
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。