QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
3.紿楀彛鏍峰紡setWindowFlags(Qt::FramelessWindowHint); //鍘繪帀紿楀彛杈規鏍囬
4.md5鍔犲瘑Qt涓嬌鐢∕D5鍔犲瘑
QCryptographicHash test(QCryptographicHash::MD5);
QByteArray data;
data.append(tr("test"));
test.addData(data);
QByteArray result = test.result();
result.toBase64(); //瀵嗘枃鐢╞ase64緙栫爜
result.toHex(); //鐢?6榪涘埗鏄劇ず鏁版嵁
5.浣跨敤澶氱嚎紼?br />緇ф壙QThread, 閲嶅啓run铏氭柟娉? 濡傛灉浣跨敤綰跨▼浜嬩歡寰幆, 鍦╮un閲岄潰浣跨敤QObject瀵硅薄騫剁敤connect鍏寵仈淇″彿, 闇瑕佸湪鏋勯犲嚱鏁伴噷璋冪敤moveToThread(this);鍚﹀垯slots妲借繕鏄湪涓昏皟綰跨▼涓璋冪敤鑰屼笉鏄湪鏂板垱寤虹殑綰跨▼涓墽琛岀殑.
6.wchar_t* 杞琎String
wchar_t* wptr = L"test";
QString ret = QString::fromWCharArray(wptr);
QString ret2 = QString((QChar*)wptr, wcslen(wptr));
QString 杞瑆char_t*
wchar_t szBuf[1024];
QString str = tr("hello");
wcscpy_s(reinterpret_cast<wchar_t*>(szBuf),
sizeof(szBuf) / sizeof(wchar_t),
reinterpret_cast<const wchar_t*>(str.utf16()));
7.QTreeView 璁劇疆鍒楀搴﹀浐瀹?br />QTreeView()::header()->setResizeMode(QHeaderView::Fixed);
8.瀵硅瘽妗嗗睆騫曞眳涓樉紺?br />quint32 scrwidth = QApplication::desktop()->width();quint32 scrheight = QApplication::desktop()->height();quint32 width = this->width();quint32 height = this->height();this->move((scrwidth - width) / 2, (scrheight - height) / 2);
9.鍙戦佷俊鍙風殑鏃跺? 涓浜涚被鍨嬩綔涓哄弬鏁? 闇瑕佹敞鍐?Q_DECLARE_METATYPE(綾誨悕)qRegisterMetaType<綾誨悕>("綾誨悕");綾誨悕涔熷彲浠ユ槸緇撴瀯浣撶瓑鍏朵粬緇撴瀯10.rcc璧勬簮鏂囦歡
bin鐩綍涓嬫湁涓猺cc.exe宸ュ叿, 鍙互鍚rc鑴氭湰緙栬瘧鎴恟cc璧勬簮2榪涘埗鏂囦歡, 鍛戒護濡備笅:
rcc -binary xxx.qrc -o xxx.rcc
鍦ㄧ▼搴忎腑寮曠敤榪欎釜rcc璧勬簮鏂囦歡:
QResource::registerResource("xxx.rcc");
鍗歌澆
QResource::unregisterResource("xxx.rcc")