工作中没有小事:点石成金,滴水成河,只有认真对待自己所做的一切事情,才能克服万难,取得成功。
转载:https://www.it1352.com/491860.html
上篇中把Qt做为子窗口嵌入到MFC对话框中,其实我们可以更灵活的使用QWinWidget和QMfcApp,把其封装成一个第三方库,方便使用。
第一步:新建MFC使用共享MFC DLL的规则DLL工程GuiPub
第二步:把qmfcapp.h qmfcapp.cpp qwinwidget.h qwinwidget.cpp放入到工程目录下,然后导入到工程
第三步:QMfcApp和QWinWidget中含有Q_OBJECT的头文件,要给该文件配置自定义生成工具(可以参考上一篇文章)
第四步:QMfcApp和QWinWidget 导出
工程属性:C/C++---》预处理--》QTLIB_EXPORT
第五步:把QMfcApp和QWinWidget这两个类从QtMfc中移除,引用GuiPub
第六步:修改引用的头文件
第七步:效果和之前直接导入QtMfc工程是一样的