- 博客(11)
- 资源 (5)
- 收藏
- 关注
原创 QTimer signal 影响
#include "test.h" #include <QTimer> #include <QDateTime> #include <Windows.h> test::test(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); ...
2019-12-27 15:30:56 291
转载 QPixmap load失败
QPixmap pixmap; pixmap.load(“D:\\lc.jpg”); 总是返回false 原因是因为运行exe时,差一个库: imageformats\qjpeg.dll 需要把Qt下 plugins/imageformats文件夹拷贝到工程exe目录 原文链接:https://blog.csdn.net/liukang325/article/details/7287...
2019-09-30 14:15:24 1451
原创 QObject: Cannot create children for a parent that is in a different thread 问题记录
记录一下,遇到过一个使用QNetworkReply下载图片没成功的问题, 排查步骤如下: 1、finished() 信号没触发,确定connect没写错 2、发现readyread()也没触发 3、vs断点调试到connect前时,有输出信息“QObject: Cannot create children for a parent that is in a different thread”...
2019-05-30 11:37:04 774
转载 This application failed to start because it could not find or load the Qt platfrom plugin "windows"
用VS 2015进行QT程序开发时,在vs界面中调试编译程序时没有问题,但是进入到生成的exe文件夹下运行exe文件是却总是跳出一个提示框: This application failed to start because it could not find or load the Qt platfrom plugin "windows" 把Qt安装目录 plugins\platform...
2019-04-26 14:58:23 1325
转载 非阻塞accept recv
unsigned __stdcall CNetServer::AcceptThread(LPVOID lpParam) { CNetServer *p = (CNetServer*)lpParam; sockaddr_in addr; int n = sizeof(addr); fd_set fds; timeval timeout; timeout.
2014-04-14 12:00:04 619 3
原创 串口封装类
#ifndef _StkComm_H #define _StkComm_H #include #include #include #include #include "def.h" using namespace std; //串口数据回调函数 typedef void(CALLBACK *OnComDataCallback)(DWORD dwSi
2014-03-19 23:34:59 817
原创 获取本机ip和外网ip地址
//获取外网地址 void GetNetIPAddress(__out std::string& IpAddr) { static std::string LocalIpAddr; if(LocalIpAddr.empty()) { char pName[256] = {0}; gethostname(pName,sizeof(pName)); hostent *pHo
2014-03-19 23:25:53 1513
原创 中文和unicode字符的相互转换
中文转换成unicode: wchar_t* ChangeCODE(const wchar_t *lpText) { int nLen = wcslen(lpText)+1; wchar_t *wcsTmp = new wchar_t[nLen]; memset(wcsTmp,0,nLen); wcscpy_s(wcsTmp,nLen,lpText); wchar_t *
2014-03-19 23:23:56 1072
原创 多字节和宽字节的互相转换函数
string UnicodeToWideChar(const wstring &str) { int nLen = WideCharToMultiByte(CP_ACP,0,str.c_str(),-1,NULL,0,NULL,NULL); char *pStr = new char[nLen]; memset(pStr,0,sizeof(char)*nLen); WideCha
2014-03-19 23:20:14 641
原创 vector string <--> text
#include #include #include using namespace std; int StringsToText(const vector &vtStr, const string &strFile) { fstream file(strFile.c_str(),ios::out); if(!file) { return 1; } file
2014-03-19 23:19:18 639
转载 vc截取整个屏幕保存成bmp图片
void CatchFullScreenToPic(const char *chFileName) { CDC *pDC = CDC::FromHandle(::GetDC(NULL)); //获取当前整个屏幕DC int nBitPerPixel = pDC->GetDeviceCaps(BITSPIXEL); //获取颜色模式 int nWidth = pDC->G
2014-03-19 23:13:28 2314
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人