1.Returns the directory that contains the application executable.
[static] QString QCoreApplication::applicationDirPath()
或
2.Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.
qApp->applicationDirPath();
2.Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.
On Windows, toNativeSeparators("c:/winnt/system32") returns "c:\winnt\system32".
The returned string may be the same as the argument on some operating systems, for example on Unix.
This function was introduced in Qt 4.2.
The returned string may be the same as the argument on some operating systems, for example on Unix.
This function was introduced in Qt 4.2.
[static] QString QDir::toNativeSeparators(const QString &pathName)
QString path = QApplication::applicationDirPath() + "/" + "24rgb.bmp";
path = QDir::toNativeSeparators(path);
3.Returns a copy of the image in the given format(图像格式转换).
QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags = Qt::AutoColor) const
4.获取文件路径的绝对路径
QString QFileInfo::absolutePath() const
QFileInfo file("C:\\Program Files\\Microsoft SQL Server\\80\\COM\\sqlvdi.dll");
QString absolutePath = file.absolutePath(); // "C:/Program Files/Microsoft SQL Server/80/COM"
5.显示非模态对话框,阻塞后面的调用,直到该非模态对话框关闭
QDialog dlg;
dlg.show();
QEventLoop loop;
connect(&dlg, SIGNAL(finished(int)), &loop, SLOT(quit()));
loop.exec(QEventLoop::ExcludeUserInputEvents);//loop.exec(),不排除用户输入事件
http://blog.csdn.net/cocoasprite/article/details/54631692
6.测量运行时间:QElapsedTimer与QTime
a.QElapsedTimer可以获得纳秒级时间间隔;
b.QTime可以获得毫秒级时间间隔。