|
DtkWidget
DTK Widget module
|
DAnchors 是一个模板类,在 DAnchorsBase 的基础上保存了一个控件指针, 将控件和锚定绑定在一起使用,相当于把“锚线”属性附加到了控件本身. 更多...
Public 成员函数 | |
| DAnchors (T *w) | |
| DAnchors (const DAnchors &me) | |
| T & | operator= (const DAnchors &me) |
| T & | operator= (T *w) |
| T * | widget () const |
| T * | operator-> () const |
| T & | operator* () const |
| operator T* () const | |
| operator T& () const | |
Public 成员函数 继承自 Dtk::Widget::DAnchorsBase | |
| DAnchorsBase (QWidget *w) | |
| 构造 DAnchorsBase 对象,传入的 w 对象会和一个新的 DAnchorsBase 对象绑定到一起 | |
| ~DAnchorsBase () | |
| 在析构时会判断此 DAnchorsBase 对象是否和 target 存在绑定关系,如果是则从映射表中移除绑定 | |
| QWidget * | target () const |
| 返回 target 控件指针 | |
| DEnhancedWidget * | enhancedWidget () const |
| 返回 target 控件的扩展对象。此对象为 QWidget 对象额外提供了和控件大小、位置相关的变化信号 | |
| bool | enabled () const |
| 返回 enabled 属性 | |
| const DAnchorsBase * | anchors () const |
| 返回 anchors 属性 | |
| const DAnchorInfo * | top () const |
| 返回 top 属性 | |
| const DAnchorInfo * | bottom () const |
| 返回 bottom 属性 | |
| const DAnchorInfo * | left () const |
| 返回 left 属性 | |
| const DAnchorInfo * | right () const |
| 返回 right 属性 | |
| const DAnchorInfo * | horizontalCenter () const |
| 返回 horizontalCenter 属性 | |
| const DAnchorInfo * | verticalCenter () const |
| 返回 verticalCenter 属性 | |
| QWidget * | fill () const |
| 返回 fill 属性 | |
| QWidget * | centerIn () const |
| 返回 centerIn 属性 | |
| int | margins () const |
| 返回 margins 属性 | |
| int | topMargin () const |
| 返回 topMargin 属性 | |
| int | bottomMargin () const |
| 返回 bottomMargin 属性 | |
| int | leftMargin () const |
| 返回 leftMargin 属性 | |
| int | rightMargin () const |
| 返回 rightMargin 属性 | |
| int | horizontalCenterOffset () const |
| 返回 horizontalCenterOffset 属性 | |
| int | verticalCenterOffset () const |
| 返回 verticalCenterOffset 属性 | |
| int | alignWhenCentered () const |
| 返回 alignWhenCentered 属性 | |
| AnchorError | errorCode () const |
| 锚定过程中产生的错误,在一个新的锚定函数被调用之前会清空此错误状态,每次调用锚定函数后,可以通过此函数的返回值来判断锚定设置是否成功。 | |
| QString | errorString () const |
| 对 errorCode 的文本描述信息 | |
| bool | isBinding (const DAnchorInfo *info) const |
| 如果此 info 设置了锚定对象,则返回 true ,否则返回 false | |
额外继承的成员函数 | |
Public 类型 继承自 Dtk::Widget::DAnchorsBase | |
| enum | AnchorError { NoError , Conflict , TargetInvalid , PointInvalid , LoopBind } |
| 设置锚定信息的过程中可能出现的错误类型 更多... | |
Public 槽 继承自 Dtk::Widget::DAnchorsBase | |
| void | setEnabled (bool enabled) |
| 设置 enabled 属性 | |
| bool | setAnchor (const Qt::AnchorPoint &p, QWidget *target, const Qt::AnchorPoint &point) |
| 为 DAnchorsBase::target 对象设置锚定规则 | |
| bool | setTop (const DAnchorInfo *top) |
| 设置 top 属性 | |
| bool | setBottom (const DAnchorInfo *bottom) |
| 设置 bottom 属性 | |
| bool | setLeft (const DAnchorInfo *left) |
| 设置 left 属性 | |
| bool | setRight (const DAnchorInfo *right) |
| 设置 right 属性 | |
| bool | setHorizontalCenter (const DAnchorInfo *horizontalCenter) |
| 设置 horizontalCenter 属性 | |
| bool | setVerticalCenter (const DAnchorInfo *verticalCenter) |
| 设置 verticalCenter 属性 | |
| bool | setFill (QWidget *fill) |
| 设置 fill 属性 | |
| bool | setCenterIn (QWidget *centerIn) |
| 设置 centerIn 属性 | |
| bool | setFill (DAnchorsBase *fill) |
| 将 fill 中的target()作为参数调用其它重载函数 | |
| bool | setCenterIn (DAnchorsBase *centerIn) |
| 将 centerIn 中的target()作为参数调用其它重载函数 | |
| void | setMargins (int margins) |
| 设置 margins 属性 | |
| void | setTopMargin (int topMargin) |
| 设置 topMargin 属性 | |
| void | setBottomMargin (int bottomMargin) |
| 设置 bottomMargin 属性 | |
| void | setLeftMargin (int leftMargin) |
| 设置 leftMargin 属性 | |
| void | setRightMargin (int rightMargin) |
| 设置 rightMargin 属性 | |
| void | setHorizontalCenterOffset (int horizontalCenterOffset) |
| 设置 horizontalCenterOffset 属性 | |
| void | setVerticalCenterOffset (int verticalCenterOffset) |
| 设置 verticalCenterOffset 属性 | |
| void | setAlignWhenCentered (bool alignWhenCentered) |
| 设置 alignWhenCentered 属性 | |
| void | setTop (int arg, Qt::AnchorPoint point) |
| 设置 target 控件到上 | |
| void | setBottom (int arg, Qt::AnchorPoint point) |
| 设置 target 控件到下 | |
| void | setLeft (int arg, Qt::AnchorPoint point) |
| 设置 target 控件到左 | |
| void | setRight (int arg, Qt::AnchorPoint point) |
| 设置 target 控件到右 | |
| void | setHorizontalCenter (int arg, Qt::AnchorPoint point) |
| 设置 target 控件水平 | |
| void | setVerticalCenter (int arg, Qt::AnchorPoint point) |
| 设置 target 控件竖直 | |
| void | moveTop (int arg) |
| 移动 target 控件的上边界到 arg 这个位置 | |
| void | moveBottom (int arg) |
| 移动 target 控件的下边界到 arg 这个位置 | |
| void | moveLeft (int arg) |
| 移动 target 控件的左边界到 arg 这个位置 | |
| void | moveRight (int arg) |
| 移动 target 控件的右边界到 arg 这个位置 | |
| void | moveHorizontalCenter (int arg) |
| 移动 target 控件的水平中线到 arg 这个位置 | |
| void | moveVerticalCenter (int arg) |
| 移动 target 控件的竖直中线到 arg 这个位置 | |
| void | moveCenter (const QPoint &arg) |
| 移动 target 控件的上边界到 arg 这个位置 | |
信号 继承自 Dtk::Widget::DAnchorsBase | |
| void | enabledChanged (bool enabled) |
信号会在 enabled 属性的值改变时被发送 | |
| void | topChanged (const DAnchorInfo *top) |
信号会在 top 属性的值改变时被发送 | |
| void | bottomChanged (const DAnchorInfo *bottom) |
信号会在 bottom 属性的值改变时被发送 | |
| void | leftChanged (const DAnchorInfo *left) |
信号会在 left 属性的值改变时被发送 | |
| void | rightChanged (const DAnchorInfo *right) |
信号会在 right 属性的值改变时被发送 | |
| void | horizontalCenterChanged (const DAnchorInfo *horizontalCenter) |
信号会在 horizontalCenter 属性的值改变时被发送 | |
| void | verticalCenterChanged (const DAnchorInfo *verticalCenter) |
信号会在 verticalCenter 属性的值改变时被发送 | |
| void | fillChanged (QWidget *fill) |
信号会在 fill 属性的值改变时被发送 | |
| void | centerInChanged (QWidget *centerIn) |
信号会在 centerIn 属性的值改变时被发送 | |
| void | marginsChanged (int margins) |
信号会在 margins 属性的值改变时被发送 | |
| void | topMarginChanged (int topMargin) |
信号会在 topMargin 属性的值改变时被发送 | |
| void | bottomMarginChanged (int bottomMargin) |
信号会在 bottomMargin 属性的值改变时被发送 | |
| void | leftMarginChanged (int leftMargin) |
信号会在 leftMargin 属性的值改变时被发送 | |
| void | rightMarginChanged (int rightMargin) |
信号会在 rightMargin 属性的值改变时被发送 | |
| void | horizontalCenterOffsetChanged (int horizontalCenterOffset) |
信号会在 horizontalCenterOffset 属性的值改变时被发送 | |
| void | verticalCenterOffsetChanged (int verticalCenterOffset) |
信号会在 verticalCenterOffset 属性的值改变时被发送 | |
| void | alignWhenCenteredChanged (bool alignWhenCentered) |
信号会在 alignWhenCentered 属性的值改变时被发送 | |
静态 Public 成员函数 继承自 Dtk::Widget::DAnchorsBase | |
| static bool | setAnchor (QWidget *w, const Qt::AnchorPoint &p, QWidget *target, const Qt::AnchorPoint &point) |
| 方便用户直接设置两个对象之间锚定关系的静态函数,调用此函数可能会隐式创建DAnchorsBase 对象。 | |
| static void | clearAnchors (const QWidget *w) |
| 清除和控件 w 相关的所有锚定关系,包括锚定w或者被w锚定的任何关联。会直接 销毁 w 对应的 DAnchorsBase 对象 | |
| static DAnchorsBase * | getAnchorBaseByWidget (const QWidget *w) |
| 返回与 w 绑定的 DAnchorsBase 对象 | |
Protected 成员函数 继承自 Dtk::Widget::DAnchorsBase | |
| void | init (QWidget *w) |
| 初始化函数 | |
属性 继承自 Dtk::Widget::DAnchorsBase | |
| QWidget * | target |
| 绑定了锚定功能的控件对象 | |
| bool | enabled |
| 控制锚定功能是否开启,为 false 时仅仅表示不会根据控件各种属性的变化来 来更新它的位置,但锚定关系并没有被解除 | |
| const DAnchorsBase * | anchors |
| 一个指向自己的指针 | |
| const DAnchorInfo * | top |
| target 控件上边界锚线的信息 | |
| const DAnchorInfo * | bottom |
| target 控件下边界锚线的信息 | |
| const DAnchorInfo * | left |
| target 控件左边界锚线的信息 | |
| const DAnchorInfo * | right |
| target 控件右边界锚线的信息 | |
| const DAnchorInfo * | horizontalCenter |
| target 控件水平锚线的信息 | |
| const DAnchorInfo * | verticalCenter |
| target 控件竖直锚线的信息 | |
| QWidget * | fill |
| target 控件的填充目标对象 | |
| QWidget * | centerIn |
| target 控件的居中目标对象 | |
| int | margins |
| 上下左右四条“锚线”的边距,此值的优先级低于每条“锚线”特定的 margin 值 | |
| int | topMargin |
| 上“锚线”的边距,优先级高于 margins | |
| int | bottomMargin |
| 下“锚线”的边距,优先级高于 margins | |
| int | leftMargin |
| 左“锚线”的边距,优先级高于 margins | |
| int | rightMargin |
| 右“锚线”的边距,优先级高于 margins | |
| int | horizontalCenterOffset |
| 水平“锚线”的偏移量 | |
| int | verticalCenterOffset |
| 竖直“锚线”的偏移量 | |
| bool | alignWhenCentered |
| 设置控件创建时是否对齐 | |
DAnchors 是一个模板类,在 DAnchorsBase 的基础上保存了一个控件指针, 将控件和锚定绑定在一起使用,相当于把“锚线”属性附加到了控件本身.
重载了 “->”、“*”、“&” 等运算符,用于把 DAnchors 这层封装透明化,
尽量减少使用DAnchors<QWidget> 和直接使用 QWidget* 对象的区别。