DtkWidget 5.6.0.2
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 | |
![]() | |
DAnchorsBase (QWidget *w) | |
构造 DAnchorsBase 对象,传入的 w 对象会和一个新的 DAnchorsBase 对象 绑定到一起 w 需要使用锚定关系的控件 更多... | |
~DAnchorsBase () | |
在析构时会判断此 DAnchorsBase 对象是否和 target 存在绑定关系,如果是 则从映射表中移除绑定 更多... | |
QWidget * | target () const |
DEnhancedWidget * | enhancedWidget () const |
返回 target 控件的扩展对象。此对象为 QWidget 对象额外提供了和控件大小、 位置相关的变化信号 更多... | |
bool | enabled () const |
const DAnchorsBase * | anchors () const |
const DAnchorInfo * | top () const |
const DAnchorInfo * | bottom () const |
const DAnchorInfo * | left () const |
const DAnchorInfo * | right () const |
const DAnchorInfo * | horizontalCenter () const |
const DAnchorInfo * | verticalCenter () const |
QWidget * | fill () const |
QWidget * | centerIn () const |
int | margins () const |
int | topMargin () const |
int | bottomMargin () const |
int | leftMargin () const |
int | rightMargin () const |
int | horizontalCenterOffset () const |
int | verticalCenterOffset () const |
int | alignWhenCentered () const |
AnchorError | errorCode () const |
锚定过程中产生的错误,在一个新的锚定函数被调用之前会清空此错误状态,每次 调用锚定函数后,可以通过此函数的返回值来判断锚定设置是否成功 更多... | |
QString | errorString () const |
对 errorCode 的文本描述信息 更多... | |
bool | isBinding (const DAnchorInfo *info) const |
如果此 info 设置了锚定对象,则返回 true ,否则返回 false 更多... | |
![]() | |
virtual const QMetaObject * | metaObject () const const |
QObject (QObject *parent) | |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
QString | objectName () const const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
bool | signalsBlocked () const const |
bool | blockSignals (bool block) |
QThread * | thread () const const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
const QObjectList & | children () const const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
void | dumpObjectTree () const const |
void | dumpObjectInfo () const const |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const const |
QList< QByteArray > | dynamicPropertyNames () const const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
bool | inherits (const char *className) const const |
void | deleteLater () |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
T | qobject_cast (QObject *object) |
T | qobject_cast (const QObject *object) |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
Q_CLASSINFO (Name, Value) | |
Q_INTERFACES (...) | |
Q_PROPERTY (...) | |
Q_ENUMS (...) | |
Q_FLAGS (...) | |
Q_ENUM (...) | |
Q_FLAG (...) | |
Q_ENUM_NS (...) | |
Q_FLAG_NS (...) | |
Q_OBJECT Q_OBJECT | |
Q_GADGET Q_GADGET | |
Q_NAMESPACE Q_NAMESPACE | |
Q_NAMESPACE_EXPORT (EXPORT_MACRO) | |
Q_SIGNALS Q_SIGNALS | |
Q_SIGNAL Q_SIGNAL | |
Q_SLOTS Q_SLOTS | |
Q_SLOT Q_SLOT | |
Q_EMIT Q_EMIT | |
Q_INVOKABLE Q_INVOKABLE | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
额外继承的成员函数 | |
![]() | |
enum | AnchorError { NoError , Conflict , TargetInvalid , PointInvalid , LoopBind } |
![]() | |
void | setEnabled (bool enabled) |
bool | setAnchor (const Qt::AnchorPoint &p, QWidget *target, const Qt::AnchorPoint &point) |
为 DAnchorsBase::target 对象设置锚定规则 更多... | |
bool | setTop (const DAnchorInfo *top) |
bool | setBottom (const DAnchorInfo *bottom) |
bool | setLeft (const DAnchorInfo *left) |
bool | setRight (const DAnchorInfo *right) |
bool | setHorizontalCenter (const DAnchorInfo *horizontalCenter) |
bool | setVerticalCenter (const DAnchorInfo *verticalCenter) |
bool | setFill (QWidget *fill) |
bool | setCenterIn (QWidget *centerIn) |
bool | setFill (DAnchorsBase *fill) |
将 fill 中的target()作为参数调用其它重载函数 fill 更多... | |
bool | setCenterIn (DAnchorsBase *centerIn) |
将 centerIn 中的target()作为参数调用其它重载函数 centerIn 更多... | |
void | setMargins (int margins) |
void | setTopMargin (int topMargin) |
void | setBottomMargin (int bottomMargin) |
void | setLeftMargin (int leftMargin) |
void | setRightMargin (int rightMargin) |
void | setHorizontalCenterOffset (int horizontalCenterOffset) |
void | setVerticalCenterOffset (int verticalCenterOffset) |
void | setAlignWhenCentered (bool alignWhenCentered) |
void | setTop (int arg, Qt::AnchorPoint point) |
void | setBottom (int arg, Qt::AnchorPoint point) |
void | setLeft (int arg, Qt::AnchorPoint point) |
void | setRight (int arg, Qt::AnchorPoint point) |
void | setHorizontalCenter (int arg, Qt::AnchorPoint point) |
void | setVerticalCenter (int arg, Qt::AnchorPoint point) |
void | moveTop (int arg) |
移动 target 控件的上边界到 arg 这个位置 arg 要移动到的位置 | |
void | moveBottom (int arg) |
移动 target 控件的下边界到 arg 这个位置 arg 要移动到的位置 | |
void | moveLeft (int arg) |
移动 target 控件的左边界到 arg 这个位置 arg 要移动到的位置 | |
void | moveRight (int arg) |
移动 target 控件的右边界到 arg 这个位置 arg 要移动到的位置 | |
void | moveHorizontalCenter (int arg) |
移动 target 控件的水平中线到 arg 这个位置 arg 要移动到的位置 | |
void | moveVerticalCenter (int arg) |
移动 target 控件的竖直中线到 arg 这个位置 arg 要移动到的位置 | |
void | moveCenter (const QPoint &arg) |
移动 target 控件的上边界到 arg 这个位置 arg 要移动到的位置 | |
![]() | |
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) |
![]() | |
static bool | setAnchor (QWidget *w, const Qt::AnchorPoint &p, QWidget *target, const Qt::AnchorPoint &point) |
方便用户直接设置两个对象之间锚定关系的静态函数,调用此函数可能会隐式创建 DAnchorsBase 对象 w 要锚定的控件对象 p 要锚定的锚线/锚点 target 锚定的目标对象 point 锚定的目标锚线/锚点 更多... | |
static void | clearAnchors (const QWidget *w) |
清除和控件 w 相关的所有锚定关系,包括锚定w或者被w锚定的任何关联。会直接 销毁 w 对应的 DAnchorsBase 对象 w | |
static DAnchorsBase * | getAnchorBaseByWidget (const QWidget *w) |
返回与 w 绑定的 DAnchorsBase 对象 w 更多... | |
![]() | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
![]() | |
typedef | QObjectList |
![]() | |
void | init (QWidget *w) |
![]() | |
QObject * | sender () const const |
int | senderSignalIndex () const const |
int | receivers (const char *signal) const const |
bool | isSignalConnected (const QMetaMethod &signal) const const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
![]() | |
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 |
![]() | |
objectName | |
DAnchors 是一个模板类,在 DAnchorsBase 的基础上保存了一个控件指针, 将控件和锚定绑定在一起使用,相当于把“锚线”属性附加到了控件本身.
\inmodule dtkwidget
重载了 “->”、“*”、“&” 等运算符,用于把 DAnchors 这层封装透明化,尽量减少使用 DAnchors<QWidget> 和直接使用 QWidget* 对象的区别。