本文整理汇总了C++中QObjectList::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ QObjectList::contains方法的具体用法?C++ QObjectList::contains怎么用?C++ QObjectList::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QObjectList
的用法示例。
在下文中一共展示了QObjectList::contains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: relationTo
/*! \reimp */
QAccessible::Relation QAccessibleApplication::relationTo(int child, const
QAccessibleInterface *other, int otherChild) const
{
QObject *o = other ? other->object() : 0;
if (!o)
return Unrelated;
if(o == object()) {
if (child && !otherChild)
return Child;
if (!child && otherChild)
return Ancestor;
if (!child && !otherChild)
return Self;
}
QWidgetList tlw(topLevelWidgets());
if (tlw.contains(qobject_cast<QWidget*>(o)))
return Ancestor;
for (int i = 0; i < tlw.count(); ++i) {
QWidget *w = tlw.at(i);
QObjectList cl = w->findChildren<QObject *>(QString());
if (cl.contains(o))
return Ancestor;
}
return Unrelated;
}
示例2: eventFilter
/**
* this is only for pre 4.2 code !
* http://ariya.ofilabs.com/2007/04/custom-toggle-action-for-qdockwidget.html
*/
bool MainWindow::eventFilter(QObject *obj, QEvent *e)
{
QObjectList windowChildren = children();
QDockWidget *w;
if (e->type() == QEvent::Close && windowChildren.contains(obj)) {
if ((w = dynamic_cast<QDockWidget *>(obj)) != NULL) {
QList<QAction*> actions = findChildren<QAction *>();
for (int i = 0; i < actions.size(); i++) {
if (actions.at(i)->text() == w->objectName()) {
actions.at(i)->setChecked(false);
return true;
}
}
}
}
return QObject::eventFilter(object, event);
//return false;
}