Qt常用代码片段

来源:互联网 发布:矩阵张量积 知乎 编辑:程序博客网 时间:2024/06/05 11:18

Returns the directory that contains the application executable.

[static] QString QCoreApplication::applicationDirPath()

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.
[static] QString QDir::toNativeSeparators(const QString &pathName)

QString path = QApplication::applicationDirPath() + "/" + "24rgb.bmp";path = QDir::toNativeSeparators(path);

Returns a copy of the image in the given format(图像格式转换).
QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags = Qt::AutoColor) const





0 0