QString c_user,c_password; c_user=CLoginUi->m_user->text().trimmed(); c_password=CLoginUi->m_password->text().trimmed(); if(c_user!=NULL&&c_...
分类:
其他好文 时间:
2015-09-02 07:06:42
阅读次数:
159
以例子说明:#include #include #include #include int main(int argc, char *argv[]){ QApplication a(argc, argv); char abc[20]; memset(abc, 0, sizeof(a...
分类:
其他好文 时间:
2015-08-31 21:23:09
阅读次数:
126
static bool GetFileMd5Code(const QString strFilePath, QString &strMD5Code) { bool bRet = false; strMD5Code = ""; if (!QFile::exis...
分类:
其他好文 时间:
2015-08-29 15:11:21
阅读次数:
169
lldb中默认没有对于QString的支持,需要自己添加。1. 在用户目录下创建~/.lldb文件夹,并在文件夹中创建`qstring.py`文件。qstring.py中内容为:import lldb def utf16string_summary(value, *rest): ...
分类:
其他好文 时间:
2015-08-29 13:55:59
阅读次数:
203
QString,QByteArray, 和QVariant这三个类和容器有许多相同之处,并且在一些情况下可以被当作特殊的容器。 同样,像容器,这些类使用隐式共享来优化内存和速度。我们将从QString开始。 字符串被每个GUI程序所使用,不仅是用户界面而且还有数据结构。 C++原生提供两种字符串: ...
分类:
其他好文 时间:
2015-08-28 21:17:50
阅读次数:
236
bool RecordDlg::excel(QString fileName )
{
QString sheetName;
sheetName="mydatas";
qDebug()
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC", "excelexport");
if(!db.isVal...
分类:
其他好文 时间:
2015-08-27 16:46:07
阅读次数:
181
QString的arg()方法用于填充字符串中的%1,%2...为给定的参数,如
QString m = tr("%1:%2:%3").arg("12").arg("60").arg("60"); // m = "12:60:60:
它还有另外一种重载方法:
QString QString::?arg(int a, int fieldWidth = 0, int base = 10, ...
分类:
其他好文 时间:
2015-08-27 02:13:40
阅读次数:
345
在需要翻译的地方之前安装QTranslator在.pro里添加翻译文件在所有需要翻译的地方添加tr每个继承于QObject的类都有tr()接口,但是我们用类自己的QString::tr("hello")使用QtCreator的工具->外部->Qt语言家-> update会在.pro指定的目录生成.t...
分类:
编程语言 时间:
2015-08-20 00:55:16
阅读次数:
320
在Qt程序调试的时候,经常需要打印一些变量,那么我们就需要使用qDebug()函数,这种函数有两种使用方法,如下所示:QString s = "Jack";qDebug() << "My name is " << s << ", nice to meet you!" << endl;qDebug("...
分类:
其他好文 时间:
2015-08-19 12:44:39
阅读次数:
173
问题:在qt中写一个方法,用指针做返回值,编译没有问题,但执行的时候程序会报错。
我的操作步骤:
1.新建一个Test的测试类,内容如下:
Test.h
Test.cpp
2.main方法去调用Test类中void fun(QString* pStr)方法,如下,程序编译执行一下,没有问题
3.接下来,打印一下main方法中参数pStr1的内容,理论下*pStr1的值会是”1...
分类:
其他好文 时间:
2015-08-16 18:29:22
阅读次数:
305