/*! \reimp */
int QAccessibleWidget::indexOfChild(const QAccessibleInterface *child) const
{
    if (!child)
        return -1;
    QWidgetList cl = childWidgets(widget());
    return cl.indexOf(qobject_cast<QWidget *>(child->object()));
}
/*! \reimp */
int QAccessibleWidget::indexOfChild(const QAccessibleInterface *child) const
{
    QWidgetList cl = childWidgets(widget());
    int index = cl.indexOf(qobject_cast<QWidget *>(child->object()));
    if (index != -1)
        ++index;
    return index;
}
示例#3
0
文件: morphmenu.cpp 项目: phen89/rtqt
// Replace widgets in a widget-list type dynamic property of the parent
// used for Z-order, etc.
static void replaceWidgetListDynamicProperty(QWidget *parentWidget,
                                             QWidget *oldWidget, QWidget *newWidget,
                                             const char *name)
{
    QWidgetList list = qvariant_cast<QWidgetList>(parentWidget->property(name));
    const int index = list.indexOf(oldWidget);
    if (index != -1) {
        list.replace(index, newWidget);
         parentWidget->setProperty(name, QVariant::fromValue(list));
    }
}