qmake 常用命令:
    qmake -project //生成pro文件,自动检查c/c  程序文件
        qmake -t lib     //生产把源码编译成库的pro工程文件
    qmake -tp vc //根据pro文件生成vc的工程文件,qt commericial有一个绑定到vs的工具,可以在菜单栏直接打开
    qmake -r xxx.pro "config =debug" //递归生成makefile
     moc        //包含q_object文件转换器
     rcc        //qt resource compiler
     uic        //qt ui file translator,to .h file.
  qt 常用宏:
     平台相关
     q_ws_win    //window系统
     q_ws_x11    //xwindow系统
     q_ws_mac    //苹果mac系统
     q_ws_sol    //sun的solaris系统
     其它
     qt_opengl_support //是否支援opengl
     qt_version    //qt的版本,如 if qt_version > 0x040601(qt > 4.6.1)
     qt_version_str    //qt版本的字符串
     qt_pointer_size   //指针的字节宽度 32bit=4,64bit=8
     qt_require_version   //用在代码中,比如qt_require_version(argc, argv, "4.0.2");
     global常用函数
     t qabs(const t & value)    //返回绝对值
     void	qcritical(const char * msg, ...) //
     void qdebug(const char * msg, ... )   //
     void	qfatal(const char * msg, ... )   //输出错误信息
     qmax(const t & value1,const t & value2 )//
     qmin(const t & value1,const t & value2 ) //
  
  pro 文件格式
  #:      表示到行尾均为注视,被忽略
  include: 可以包含别的文本文件,一般为*pri 例如 #include "../global.pri"
  scope{;;}: 预定义 ,如win32{} 表示在win32平台下的定义,其它忽略
  win32/unix/linux-g  /linux-g  -64: 平台宏
  destdir: 产生目标文件路径
  moc_dir: moc转换文件路径
  rcc_dir: 资源文件路径
  ui_dir:ui文件转换的路径
  libext: 产生lib的后缀
  qmake_cflags_debug:
  qmake_cxxflags_debug:
  qmake_cflags_release:
  qmake_cxxflags_release:
  template: 决定生成makefile采用的模板,
       =lib  表示库文件
       =app  表示生成可执行文件
       =subdirs 表示处理子目录(在下面用subdirs  = **来指定那些子目录)
  target: 指定目标文件名
  qt =: 添加额外的模块支持,例如qt -= qtcore;qt  = network,phonon,xml,thread
  defines: 添加额外的宏定义,如win下需要的export等
  dependpath: 添加以来的路径
  includepath: 添加头文件包含路径
  headers: 需要包含的头文件
  sources: 需要包含的源文件
  forms: 需要包含的ui文件
  resources:需要包含的资源文件
  libs:依赖库的路径和名称 -l{xxdirxx} -l{xxnamexx}
  config: 添加配置,如warn_on debug_and_release plugin
  translations: 多国语言支持文件
  installs: 要安装的文件
  target.path: 安装的路径
  #在pro文件支持environment variables和自定义变量
  #如sources.file  = $$sources $$headers
  #sources.path = $$destin_dir
  #installs  = target source
  definereplace(xxx): xxx为变量 ,此函数可以返回一个变量值如:$$xxx()
    exists(file1,file2){error()}:检查文件是否存在
		
		
		                                   
            
            
              
              阅读(4871) | 评论(0) | 转发(0) |