免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1862 | 回复: 0
打印 上一主题 下一主题

windows下利用qt designer编写GUI程序 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-23 17:39 |只看该作者 |倒序浏览
windows下利用qt designer编写GUI程序

首先,利用qt designer设计一个窗口,然后保存为*.ui
这里保存为test.ui
然后编写main.cpp
内容如下:
#include QApplication>
#include QDialog>
#include "ui_test.h"
int main(int argc,char** argv)
{
    QApplication app(argc,argv);
    Ui::Dialog ui;
    QDialog * dialog = new QDialog;
    ui.setupUi(dialog);
    dialog->show();
    return app.exec();
}
然后编译程序
I:\test>qmake -project -o test.pro
I:\test>qmake test.pro
I:\test>mingw32-make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `I:/test'
c:\Qt\2009.05\qt\bin\uic.exe test.ui -o ui_test.h
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt
\2009.05\qt\include\QtCore" -I"c:\Qt\2009.05\qt\include\QtGui" -I"c:\Qt\2009.05\
qt\include" -I"." -I"c:\Qt\2009.05\qt\include\ActiveQt" -I"debug" -I"." -I"c:\Qt
\2009.05\qt\mkspecs\win32-g++" -o debug\main.o main.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o debug\test.exe debug/main.o -L"c:\Qt
\2009.05\qt\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `I:/test'
I:\test>cd debug
I:\test\debug>dir
I:\test\debug 的目录
2010/01/23 17:31 DIR> .
2010/01/23 17:31 DIR> ..
2010/01/23 17:31 198,314 main.o
2010/01/23 17:31 536,282 test.exe
               2 个文件 734,596 字节
               2 个目录 35,651,584 可用字节
I:\test\debug>test.exe


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/98826/showart_2158608.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP