Utils::StringAspect Class
class Utils::StringAspect字符串方面是指某个对象的字符串样式属性,以及对其在可视化或持久化等常见操作中的行为描述。更多内容...
| Header: | #include <StringAspect> |
| Inherits: | Utils::TypedAspect |
公共类型
| enum | DisplayStyle { LabelDisplay, LineEditDisplay, TextEditDisplay, PasswordLineEditDisplay } |
公共函数
| StringAspect(Utils::AspectContainer *container = nullptr) | |
| void | makeCheckable(Utils::CheckBoxPlacement checkBoxPlacement, const QString &checkerLabel, const Utils::Key &checkerKey) |
| void | setDisplayFilter(const std::function<QString (const QString &)> &displayFilter) |
| void | setDisplayStyle(Utils::StringAspect::DisplayStyle displayStyle) |
| void | setElideMode(Qt::TextElideMode elideMode) |
| void | setHistoryCompleter(const Utils::Key &historyCompleterKey) |
| void | setPlaceHolderText(const QString &placeHolderText) |
重新实现的公共函数
| virtual void | fromMap(const Utils::Store &map) override |
| virtual void | toMap(Utils::Store &map) const override |
详细说明
字符串方面可以表示例如外部命令的参数、文件系统中的路径,或者只是简单的字符串。
字符串可以使用QLabel 、QLineEdit 、QTextEdit 或Utils::PathChooser 进行显示。
可视化表示通常在实际值的显示前包含一个标签。
成员类型文档
enum StringAspect::DisplayStyle
DisplayStyle 枚举描述了字符串方面主要的可视化特征。
| 常量 | 值 | 描述 |
|---|---|---|
Utils::StringAspect::LabelDisplay | 0 | 基于QLabel ,用于用户无法在此处更改的文本,例如在构建系统中定义的可执行文件名称。 |
Utils::StringAspect::LineEditDisplay | 1 | 基于QLineEdit ,用于通常能在一行内显示完的用户可编辑字符串。 |
Utils::StringAspect::TextEditDisplay | 2 | 基于QTextEdit ,用于用户可编辑但通常无法在一行内显示完的字符串。 |
Utils::StringAspect::PasswordLineEditDisplay | 3 | 基于QLineEdit ,用于密码字符串 |
另请参阅 Utils::PathChooser 。
成员函数文档
StringAspect::StringAspect(Utils::AspectContainer *container = nullptr)
构建字符串方面container 。
[override virtual] void StringAspect::fromMap(const Utils::Store &map)
重新实现了:BaseAspect::fromMap (const Utils::Store &map)。
void StringAspect::makeCheckable(Utils::CheckBoxPlacement checkBoxPlacement, const QString &checkerLabel, const Utils::Key &checkerKey)
根据checkBoxPlacement ,向行编辑框添加一个带有checkerLabel 的复选框。
当使用非空的checkerKey 时,复选框的状态将被持久化。
void StringAspect::setDisplayFilter(const std::function<QString (const QString &)> &displayFilter)
设置一个displayFilter ,用于微调此字符串方面所显示值的视觉效果。
void StringAspect::setDisplayStyle(Utils::StringAspect::DisplayStyle displayStyle)
根据displayStyle ,选择该场景的主要显示特性。
注意:并非 所有StringAspect 功能在所有显示样式下都可用。
另请参阅 Utils::StringAspect::DisplayStyle 。
void StringAspect::setElideMode(Qt::TextElideMode elideMode)
将elideMode 设置为标签省略模式。
void StringAspect::setHistoryCompleter(const Utils::Key &historyCompleterKey)
将historyCompleterKey 设置为行编辑和路径选择器显示的历史记录补全设置的键。
另请参阅 Utils::PathChooser::setExpectedKind()。
void StringAspect::setPlaceHolderText(const QString &placeHolderText)
将placeHolderText 设置为行和文本显示的占位符。
[override virtual] void StringAspect::toMap(Utils::Store &map) const
重新实现了:BaseAspect::toMap (Utils::Store &map)const。
Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.