DtkWidget 5.6.0.2
DTK Widget module
|
标签输入控件. 更多...
Public 槽 | |
void | setCrumbReadOnly (bool crumbReadOnly) |
设置或取消设置标签编辑控件的只读状态 更多... | |
void | setCrumbRadius (int crumbRadius) |
设置控件圆角角度 更多... | |
void | setSplitter (const QString &splitter) |
设置分割符 更多... | |
void | setDualClickMakeCrumb (bool flag) Q_DECL_NOEXCEPT |
信号 | |
void | crumbAdded (const QString &text) |
void | crumbRemoved (const QString &text) |
void | crumbListChanged () |
Public 成员函数 | |
DCrumbEdit (QWidget *parent=0) | |
bool | insertCrumb (const DCrumbTextFormat &format, int pos=-1) |
像标签编辑控件中插入新的标签 更多... | |
bool | insertCrumb (const QString &text, int pos=-1) |
像标签编辑控件中插入新的标签 更多... | |
bool | appendCrumb (const DCrumbTextFormat &format) |
像标签编辑控件中追加新的标签 更多... | |
bool | appendCrumb (const QString &text) |
像标签编辑控件中追加新的标签 更多... | |
bool | containCrumb (const QString &text) const |
检查当前控件是否已经包含了 text 标签 text 待检查的标签文字名称 更多... | |
QStringList | crumbList () const |
Get a list of crumb/tags inside the crumb edit widget. 更多... | |
DCrumbTextFormat | crumbTextFormat (const QString &text) const |
Get the DCrumbTextFormat matched the given tag text name. 更多... | |
DCrumbTextFormat | makeTextFormat () const |
创建一个直接可用的 DCrumbTextFormat 对象. 更多... | |
DCrumbTextFormat | makeTextFormat (CrumbType type) const |
根据所给的标签类型(颜色)创建一个直接可用的 DCrumbTextFormat 对象. 更多... | |
bool | dualClickMakeCrumb () const Q_DECL_NOEXCEPT |
bool | crumbReadOnly () const |
int | crumbRadius () const |
QString | splitter () const |
Protected 成员函数 | |
bool | event (QEvent *e) override |
void | paintEvent (QPaintEvent *event) override |
void | keyPressEvent (QKeyEvent *event) override |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
void | focusOutEvent (QFocusEvent *event) override |
QMimeData * | createMimeDataFromSelection () const override |
bool | canInsertFromMimeData (const QMimeData *source) const override |
void | insertFromMimeData (const QMimeData *source) override |
属性 | |
bool | crumbReadOnly |
int | crumbRadius |
QString | splitter |
bool | dualClickMakeCrumb |
标签输入控件.
\inmodule dtkwidget
Tag Edit Widget.
DCrumbEdit provide a edit widget as a container for user entered Tags (or say, Crumbs), and allow user edit the existed tags inside this widget. Tags comes with different text, each of the tags inside the same DCrumbEdit should have different text.
The tag, or say crumb, use its text as an identifier, and it comes with other properties like tag color and etc.
DCrumbEdit allowed user add a tag by providing a simple QString or provide a custom DCrumbTextFormat object. Refer to appendCrumb() and insertCrumb() to see the usage. To get a list of tags/crumbs, see crumbList()
DCrumbEdit 提供了一个编辑框,编辑框内可包含若干个标签,并允许通过用户输入来编辑这些标签。编辑框所包含的标签可通过标签的文字 内容确定唯一的标签,即编辑框所包含的标签内容(字符串值)均不重复。
编辑框中包含的标签的主体为字符串,除文字外,每个标签可以对应其不同的颜色等样式,对于可供使用的样式请参见 DCrumbTextFormat 。 DCrumbEdit 允许通过给定字符串的形式便捷的向其中添加一个默认样式的标签,也可以通过自行构建标签文字样式。请参见 insertCrumb() 和 appendCrumb() 的不同重载。可以通过 crumbList() 获得当前标签输入控件中包含的标签列表。
bool Dtk::Widget::DCrumbEdit::appendCrumb | ( | const DCrumbTextFormat & | format | ) |
像标签编辑控件中追加新的标签
Append new tag/crumb to the crumb edit widget.
format 一个 DCrumbTextFormat 对象. format a DCrumbTextFormat.
通过给定的 DCrumbTextFormat 对象所描述的属性创建新的标签并追加到标签编辑控件中。若要创建一个直接可供使用的 DCrumbTextFormat 对象,可以考虑使用 makeTextFormat() 。 Append new tag/crumb with the provided DCrumbTextFormat. To create a ready-to-use DCrumbTextFormat object, call makeTextFormat().
bool Dtk::Widget::DCrumbEdit::appendCrumb | ( | const QString & | text | ) |
像标签编辑控件中追加新的标签
Append new tag/crumb to the crumb edit widget.
text 标签的文字内容. text of the tag/crumb.
通过给定的文字创建新的标签并追加到标签编辑控件中。 Append new tag/crumb with the provided text.
|
overrideprotected |
\reimp
bool Dtk::Widget::DCrumbEdit::containCrumb | ( | const QString & | text | ) | const |
检查当前控件是否已经包含了 text 标签 text 待检查的标签文字名称
|
overrideprotected |
\reimp
QStringList Dtk::Widget::DCrumbEdit::crumbList | ( | ) | const |
Get a list of crumb/tags inside the crumb edit widget.
取得标签输入控件内已包含的标签列表
DCrumbTextFormat Dtk::Widget::DCrumbEdit::crumbTextFormat | ( | const QString & | text | ) | const |
Get the DCrumbTextFormat matched the given tag text name.
根据标签名称取得对应的标签样式属性 DCrumbTextFormat 对象
|
overrideprotected |
\reimp
bool Dtk::Widget::DCrumbEdit::insertCrumb | ( | const DCrumbTextFormat & | format, |
int | pos = -1 |
||
) |
像标签编辑控件中插入新的标签
Insert new tag/crumb to the crumb edit widget at the given position.
format 一个 DCrumbTextFormat 对象. format a DCrumbTextFormat. pos 待插入的位置. pos position to be inserted.
通过给定的 DCrumbTextFormat 对象所描述的属性创建新的标签并追加到标签编辑控件中。若要创建一个直接可供使用的 DCrumbTextFormat 对象,可以考虑使用 makeTextFormat() 。 Insert new tag/crumb with the provided DCrumbTextFormat at the given position. To create a ready-to-use DCrumbTextFormat object, call makeTextFormat().
bool Dtk::Widget::DCrumbEdit::insertCrumb | ( | const QString & | text, |
int | pos = -1 |
||
) |
像标签编辑控件中插入新的标签
Insert new tag/crumb to the crumb edit widget.
text 标签的文字内容. text of the tag/crumb. pos 待插入的位置. pos position to be inserted.
通过给定的文字创建新的标签并插入到标签编辑控件中的指定位置。 Insert new tag/crumb with the provided text to the given position.
|
overrideprotected |
\reimp
|
overrideprotected |
\reimp
DCrumbTextFormat Dtk::Widget::DCrumbEdit::makeTextFormat | ( | ) | const |
创建一个直接可用的 DCrumbTextFormat 对象.
create a ready-to-use DCrumbTextFormat object.
DCrumbTextFormat Dtk::Widget::DCrumbEdit::makeTextFormat | ( | DCrumbEdit::CrumbType | type | ) | const |
根据所给的标签类型(颜色)创建一个直接可用的 DCrumbTextFormat 对象.
create a ready-to-use DCrumbTextFormat object with the given color.
将根据所给的(颜色)类型创建一个新的 DCrumbTextFormat 对象,并将其内文字属性设为颜色的名称。 Create a ready-to-use DCrumbTextFormat object with the given color, and set its text as the color name.
|
overrideprotected |
\reimp
|
overrideprotected |
\reimp
|
slot |
设置控件圆角角度
crumbRadius 圆角角度.
|
slot |
设置或取消设置标签编辑控件的只读状态
crumbReadOnly 是否只读.
|
slot |
设置分割符
设置表示划分标签边界的分割字符,可用于一次性输入多个以给定分隔符分割的标签。
splitter 分割线字符.