Qt -- button的使用
2015-10-06 14:46
411 查看
创建一个button部件,作为主窗口,点击该button退出窗体;
quit.cpp
1.qmake -project --- 生成工程文件
2.qmake quit.pro ---生成一个makefile
3.make ---编译
4.debug\quit.exe --- 运行程序
![](http://img.blog.csdn.net/20151006144553532?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
F:\QT_Program\test01\quit>qmake -project
F:\QT_Program\test01\quit>qmake quit.pro
F:\QT_Program\test01\quit>make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `F:/QT_Program/test01/quit'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -
DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\Qt\4.7
.3\include\QtCore" -I"d:\Qt\4.7.3\include\QtGui" -I"d:\Qt\4.7.3\include" -I"." -
I"d:\Qt\4.7.3\include\ActiveQt" -I"debug" -I"d:\Qt\4.7.3\mkspecs\win32-g++" -o d
ebug\quit.o quit.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o debug\quit.exe debug/quit.o -L"d:\Qt
\4.7.3\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `F:/QT_Program/test01/quit'
F:\QT_Program\test01\quit>debug\quit.exe
F:\QT_Program\test01\quit>
quit.cpp
//使用按键作为主窗口,带有退出功能 #include <QApplication> #include <QPushButton> int main(int argc,char *argv[]) { QApplication app(argc,argv); //创建QApplication对象app管理应用程序 QPushButton *button = new QPushButton("quit"); //创建一个button部件 QObject::connect(button,SIGNAL(clicked()),&app,SLOT(quit())); //创建一个连接,使button与app建立响应 button->show(); //显示button对象 return app.exec(); //进入循环主体 }
1.qmake -project --- 生成工程文件
2.qmake quit.pro ---生成一个makefile
3.make ---编译
4.debug\quit.exe --- 运行程序
F:\QT_Program\test01\quit>qmake -project
F:\QT_Program\test01\quit>qmake quit.pro
F:\QT_Program\test01\quit>make
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `F:/QT_Program/test01/quit'
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -
DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"d:\Qt\4.7
.3\include\QtCore" -I"d:\Qt\4.7.3\include\QtGui" -I"d:\Qt\4.7.3\include" -I"." -
I"d:\Qt\4.7.3\include\ActiveQt" -I"debug" -I"d:\Qt\4.7.3\mkspecs\win32-g++" -o d
ebug\quit.o quit.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
oc -mthreads -Wl -Wl,-subsystem,windows -o debug\quit.exe debug/quit.o -L"d:\Qt
\4.7.3\lib" -lmingw32 -lqtmaind -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `F:/QT_Program/test01/quit'
F:\QT_Program\test01\quit>debug\quit.exe
F:\QT_Program\test01\quit>
相关文章推荐
- QT开发--hello
- QT中一些常用的类
- 如何分析一个QT类
- Ubuntu14.04中编译安装maliit-0.94-qt4
- QT5 学习之路30---Graphics View Framework
- QT5 学习之路29---绘制设备
- QT5 学习之路28---坐标系统
- QT5 学习之路27---渐变
- QT5 学习之路26---反走样
- qt4 arm显示error
- QT不同版本编译
- QT5 学习之路25---画刷和画笔
- QT5 学习之路24---Qt 绘制系统简介
- MQTT的简单应用
- QT5 学习之路23---事件总结
- QT5 学习之路22---事件过滤器
- QT5 学习之路21---文件对话框
- QT5 学习之路20---标准对话框 QMessageBox
- Qt4过渡至Qt5
- qt绘制坐标系--利用QCustomPlot