TTheme Class
Header: | #include <TTheme> |
Inherits: | QObject |
Public Types
enum | BgType { BgType_Light, BgType_Dark } |
Public Slots
void | applyTheme() |
BgType | bgType() const |
qreal | dp(qreal iPix) const |
int | dp(int iPix) const |
qreal | dpRatio() const |
QGraphicsDropShadowEffect * | getShadowEffect(int iDepth, const QString &iDirection = "center") |
QString | getSsColor(const QString &iKeyStr) |
bool | loadThemeConfig(const QString &iFile) |
QString | qssStr() const |
void | setDpRatio(qreal iRatio) |
void | setQssStr(const QString &iQssStr) |
void | setStyle(const QString &iStyleStr) |
void | setValueMap(const QVariantMap &iValueMap) |
QVariant | value(const QString &iKeyStr) const |
- 1 public slot inherited from QObject
Static Public Members
QString | html2StyleSheetColor(const QString &iColor) |
TTheme * | 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
TTheme 是配置框架应用程序窗体主题风格的类.
Member Function Documentation
[slot]
void TTheme::applyTheme()
应用已经设置好的主题风格的属性值.
[slot]
BgType TTheme::bgType() const
This property holds the TTheme::BgType of theme.
[slot]
qreal TTheme::dp(qreal iPix) const
根据dpRatio()的值计算得到与主题风格相适应的值.
[slot]
int TTheme::dp(int iPix) const
根据dpRatio()的值计算得到与主题风格相适应的值.
[slot]
qreal TTheme::dpRatio() const
This property holds the ratio of widget's size theme.
默认的, 如果屏幕宽度小于1920, ratio值为1.0, 大于1920时为1.5.
可以使用setDpRatio()函数手动修改dpRatio的值
.
See also setDpRatio().
[slot]
QGraphicsDropShadowEffect *TTheme::getShadowEffect(int iDepth, const QString &iDirection = "center")
用来得到主题风格的阴影类实例的指针, 实例的属性根据dpRatio()的值的改变而改变.
iDepth 设置阴影的范围大小. 可取值为: 0,1,2,3,4,5; 值越大,或者dpRatio()值越大,阴影范围越大.
iDirection 设置阴影在窗体上的位置. 可取值为:"LEFT", "RIGHT", "TOP", "BOTTOM".
[slot]
QString TTheme::getSsColor(const QString &iKeyStr)
提取某个属性值中的颜色子属性值
iKeyStr 主题风格的某个属性名
[static]
QString TTheme::html2StyleSheetColor(const QString &iColor)
该函数为静态函数, 用来转换html字符串为stylesheet 颜色值字符串
iColor html字符串
[static]
TTheme *TTheme::instance()
该函数为静态函数, 用来获取TTheme的唯一实例的引用.
[slot]
bool TTheme::loadThemeConfig(const QString &iFile)
根据配置文件路径载入风格属性配置.
iFile 风格配置文件路径
[slot]
QString TTheme::qssStr() const
This property holds the theme's qssStr.
返回主题风格的QSS属性字符串.
使用setQssStr()设置QSS属性字符串
See also setQssStr().
[slot]
void TTheme::setDpRatio(qreal iRatio)
用来设置主题风格的dpRatio
的值.
iRatio 要设置的主题风格的dpRatio值,
可以使用dpRatio()
函数获取dpRatio值.
See also dpRatio().
[slot]
void TTheme::setQssStr(const QString &iQssStr)
设置主题风格的QSS属性字符串
使用qssStr()函数返回QSS属性字符串
iQssStr 要设置的QSS字符串
See also qssStr().
[slot]
void TTheme::setStyle(const QString &iStyleStr)
设置框架应用程序的style.
iStyleStr 要设置的应用程序style字符串
See also QApplication::setStyle().
[slot]
void TTheme::setValueMap(const QVariantMap &iValueMap)
设置主题风格的相应属性对应的值.
iValueMap 要设置的主题风格的所有属性和对应值
[slot]
QVariant TTheme::value(const QString &iKeyStr) const
用来得到主题风格某个属性的值.
iKeyStr 主题风格的某个属性名