摘要: handshake(握手) client请求: GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBu... 阅读全文
posted @ 2014-04-26 16:07 淡菊 阅读(8703) 评论(0) 推荐(0) 编辑
摘要: 一直没找到Qt中方便的gzip模块,于是自己动手,调用zlib模块实现了一份. 目标: 1.gzip的压缩与解压 2.内存中操作 3.方便的Qt接口 实现分析: gzip 压缩算法为 deflate inflateInit2时要求zlib库忽略zlib header gzip 在 deflate ... 阅读全文
posted @ 2014-04-26 16:02 淡菊 阅读(4880) 评论(1) 推荐(0) 编辑
摘要: Delphi部分 type TGuardInfo=record Lock: Integer; end; PGuardInfo = ^TGuardInfo; TGuardShareMem=class private FHandle: THandle; FGuardInfo: PGuardInfo;... 阅读全文
posted @ 2014-04-26 14:31 淡菊 阅读(1476) 评论(0) 推荐(0) 编辑
摘要: 安装postgreSQL,安装目录下的lib和bin添加到path打开Qt安装目录,找到src\plugins\sqldrivers\psql编辑psql.pro,添加INCLUDEPATH += "E:/PostgreSQL/9.2/include"LIBS += "E:/PostgreSQL/9... 阅读全文
posted @ 2014-04-26 14:27 淡菊 阅读(2612) 评论(1) 推荐(0) 编辑
摘要: .pro项目文件中加入 QT += phonon包含头 #include 播放文件 Phonon::MediaObject *media = new Phonon::MediaObject; Phonon::AudioOutput *audioOutput = new Phonon::AudioOu... 阅读全文
posted @ 2014-04-26 14:23 淡菊 阅读(1279) 评论(0) 推荐(0) 编辑
摘要: 下面的智能指针分别对应boost库,Qt库,c++11的智能指针boost::scoped_ptr QScopedPointer unique_ptr 在其生命期结束后会自动删除它所指的对象(确定无需共享)boost::shared_ptr QSharedPointer shared_ptr 引用计... 阅读全文
posted @ 2014-04-26 14:20 淡菊 阅读(1155) 评论(0) 推荐(1) 编辑
摘要: 单元测试之作用要完成测试用例,保证设计上的耦合依赖通过测试用例,保证覆盖率,提高程序质量QTest一些有用的静态函数QTest::qExecQTest::qSleepQTest::qWait 例子 .pro项目文件中加入QT += testlibint main(int argc, char *a... 阅读全文
posted @ 2014-04-26 14:11 淡菊 阅读(4249) 评论(0) 推荐(0) 编辑
摘要: 项目中需要多语言的部分以tr宏包含例:setWindowTitle(tr("编辑"));.pro项目文件加入CODECFORTR = utf-8 #or gbk#DEFAULTCODEC = utf-8#CODEC = utf-8TRANSLATIONS = en.ts调用工具,生成.ts文件lup... 阅读全文
posted @ 2014-04-26 14:07 淡菊 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 一、准备软件1. MinGW (C:\Qt\MinGW)http://pan.baidu.com/share/link?shareid=174269&uk=673227135这个文件解压就可以用了。2. ActivePerl3. qt-win-opensource-4.8.4-mingw.exe (... 阅读全文
posted @ 2014-04-26 14:02 淡菊 阅读(10214) 评论(0) 推荐(0) 编辑