TResource Class

资源管理类; More...

Header: #include <TResource>
Inherits: QObject

Public Slots

void appendIconPath(const QString &iPathStr)
void appendResourcePath(const QString &iPathStr)
void autoFindPathList()
void clearIconPath()
void clearResourcePath()
QIcon colorIcon(const QString &iNameStr) const
QIcon icon(const QString &iNameStr, const QString &iColorTypeStr = "button", const QString &iBgType = "body") const
QString iconFilePath(const QString &iNameStr) const
QStringList iconPathList() const
bool loadRcc(const QString &iRccNameStr)
void prependIconPath(const QString &iPathStr)
void prependResourcePath(const QString &iPathStr)
QIcon refillIcon(const QIcon &iIcon, const QString &iColor)
void removeIconPath(const QString &iPathStr)
void removeResourcePath(const QString &iPathStr)
QString resourceFilePath(const QString &iNameStr) const
QStringList resourcePathList() const
void setRccDir(const QString &iDirStr)
  • 1 public slot inherited from QObject

Static Public Members

TResource *instance()
  • 10 static public members inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 31 public functions inherited from QObject
  • 2 signals inherited from QObject
  • 1 public variable inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

资源管理类;

Member Function Documentation

[slot] void TResource::appendIconPath(const QString &iPathStr)

将路径 iPathStr 追加到图标的路径列表后;

[slot] void TResource::appendResourcePath(const QString &iPathStr)

将路径 iPathStr 追加到资源的路径列表后;

[slot] void TResource::autoFindPathList()

自动查找路径; 执行此函数后, 会循环":/"目录下的子目录, 将子目录下的icon目录追加至图标路径列表中, 将子目录下的image,images,file,files目录追加至资源路径列表中;如":/system/icon"会追加至图标路径列表中, ":/topmes/image"会追加至资源路径列表中;

[slot] void TResource::clearIconPath()

清除图标的路径列表;

[slot] void TResource::clearResourcePath()

清除资源路径列表;

[slot] QIcon TResource::colorIcon(const QString &iNameStr) const

获取图标 iNameStr; iNameStr的格式为<图标名>.<颜色>; <颜色>为颜色对应的html代码; 如"add.#ff0000" 表示返回红色的add图标; 颜色也支持半透明,如"add.#ff0000a0"; 如果后缀为$XXXXX, 则表示从Theme中获取对应的变量; 如果颜色后缀为ORG,则表示图标不经过颜色处理,直接返回图标本来的颜色;

[slot] QIcon TResource::icon(const QString &iNameStr, const QString &iColorTypeStr = "button", const QString &iBgType = "body") const

[slot] QString TResource::iconFilePath(const QString &iNameStr) const

获取图标 iNameStr 的全路径, 如果图标后缀为.svg, 则 iNameStr 可以不用加后缀; 如: iNameStr 为"add", 会优先查找"add.svg"文件;

[slot] QStringList TResource::iconPathList() const

返回图标路径列表;

[static] TResource *TResource::instance()

返回资源管理类的单例对象;

[slot] bool TResource::loadRcc(const QString &iRccNameStr)

加载RCC资源

[slot] void TResource::prependIconPath(const QString &iPathStr)

将路径 iPathStr 插入到图标的路径列表前;

[slot] void TResource::prependResourcePath(const QString &iPathStr)

将路径 iPathStr 插入到资源的路径列表前;

[static slot] QIcon TResource::refillIcon(const QIcon &iIcon, const QString &iColor)

将图标 iIcon 转化成 iColor 颜色; iColor 为空或ORG表示不进行转换;

[slot] void TResource::removeIconPath(const QString &iPathStr)

将路径 iPathStr 从图标的路径列表中移除;

[slot] void TResource::removeResourcePath(const QString &iPathStr)

将路径 iPathStr 从资源的路径列表中移除;

[slot] QString TResource::resourceFilePath(const QString &iNameStr) const

获取资源 iNameStr 的文件全路径;

[slot] QStringList TResource::resourcePathList() const

返回资源路径列表;

[slot] void TResource::setRccDir(const QString &iDirStr)

设置应用程序的RCC目录