Qt程序只运行一个实例
littlesu | 开发经验 | 2013-01-16
C++
#include "qtsingleapplication.h"
int main(int argc, char *argv[])
{
QtSingleApplication instance(argc, argv);
if (instance.sendMessage("Wake up!"))
{
QMessageBox::warning(NULL, QObject::tr("打开程序出错"), QObject::tr("只允许运行... [阅读全文]
chrome 扩展 + 插件
littlesu | 开发经验 | 2013-01-16
chrome 有2种扩展 1.Browser Action;2.page actions
Chrome扩展就是几个网页,那么代码当然就是网页的JavaScript
有帮助的网页:http://blog.neverbest.com/?p=276
google chrome api: http://developer.chrome.com/extensions/api_index.html
chrome.browserAction http://developer.chrome.com/extensions/brow... [阅读全文]
qt 获取 MD5
littlesu | 开发经验 | 2013-01-15
C++
QFile
QString Hashes::MD5(QFile *fileStream)
{
QString md5;
QByteArray hashData = QCryptographicHash::hash(fileStream->readAll(), QCryptographicHash::Md5);
md5.append(hashData.toHex());
fileStream->close();
return md5;
}
1.
#in... [阅读全文]
Qt 程序里播放 flash
littlesu | 开发经验 | 2013-01-15
C++
#include <QtGui>
#include <QAxWidget>
/**
* 此方法仅限于Windows
*/
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QAxWidget *flash = new QAxWidget(0,0);
flash->resize(1000,700);
flash->setControl(QString::fromUtf8(&qu... [阅读全文]
创建 GUID
littlesu | Qt Gui | 2013-01-15
C++
#include <QUuid>
QUuid().createUuid ().toString();
QUuid().createUuid ().toString().toUpper().remove(QChar('-'), Qt::CaseSensitive);
QUuid().createUuid ().toString().toUpper().remove(QChar('-'), Qt::CaseSensitive).remove(QChar('{... [阅读全文]
qt 设置日志
littlesu | 开发经验 | 2013-01-15
C++
#include <QtCore/QCoreApplication>
#include <QtDebug>
#include <QFile>
#include <QTextStream>
void customMessageHandler(QtMsgType type, const char *msg)
{
QString txt;
switch (type) {
//调试信息提示
case QtDebugMsg:
... [阅读全文]
multiple keyboard shortcuts
littlesu | 开发经验 | 2013-01-15
C++
ui.actionProperties->setShortcuts(QList<QKeySequence>()
<< QKeySequence(QString("Alt+Return")) << QKeySequence(QString("Alt+Enter")));
12
ui.actionProperties->setShortcuts... [阅读全文]
枚举 杀死进程
littlesu | 开发经验 | 2013-01-15
C++
void CKillProcessDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
CString processName;
m_processName.GetWindowText(processName);
CString strMsg;
strMsg += "一共杀死进程";
strMsg += processName;
CString str;
str.Format( "%d 个&quo... [阅读全文]
qt window 文件名去掉不合法字符
littlesu | 开发经验 | 2013-01-15
C++
QString name(fileName);
name = name.replace(QRegExp("[/*?:<>|"\]"), "");
12
QString name(fileName);name = name.replace(QRegExp("[/*?:<>|"\]"), ""... [阅读全文]
vs 2005 qt下编译 MYsql 驱动
littlesu | 开发经验 | 2013-01-15
C++
不能完全相信网上的帖子。。。
第一步安装mysql ,安装时选择完整安装,否则不会安装include和lib
第二步复制mysql 下的include和lib文件夹到 c:MysqlDrive下
第三步在dos下运行C:Program FilesMicrosoft Visual Studio 8Common7Toolsvsvars32.bat
第四步 vs2005命令行 cd C:Qt4.6.4srcpluginssqldriversmysql【命令行... [阅读全文]