当前位置: 首页>>代码示例>>C++>>正文


C++ QWidgetList::push_back方法代码示例

本文整理汇总了C++中QWidgetList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidgetList::push_back方法的具体用法?C++ QWidgetList::push_back怎么用?C++ QWidgetList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWidgetList的用法示例。


在下文中一共展示了QWidgetList::push_back方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pagesOfContainer

QWidgetList OrderDialog::pagesOfContainer(const QDesignerFormEditorInterface *core, QWidget *container)
{
    QWidgetList rc;
    if (QDesignerContainerExtension* ce = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), container)) {
        const int count = ce->count();
        for (int i = 0; i < count ;i ++)
            rc.push_back(ce->widget(i));
    }
    return rc;
}
开发者ID:Fale,项目名称:qtmoko,代码行数:10,代码来源:orderdialog.cpp

示例2: execDrag

Qt::DropAction QDesignerMimeData::execDrag(const QDesignerDnDItems &items, QWidget * dragSource)
{
    if (items.empty())
        return Qt::IgnoreAction;

    QDrag *drag = new QDrag(dragSource);
    QDesignerMimeData *mimeData = new QDesignerMimeData(items, drag);

    // Store pointers to widgets that are to be re-shown if a move operation is canceled
    QWidgetList reshowWidgets;
    const QDesignerDnDItems::const_iterator cend = items.constEnd();
    for (QDesignerDnDItems::const_iterator it = items.constBegin(); it != cend; ++it )
        if (QWidget *w = (*it)->widget())
            if ((*it)->type() ==  QDesignerDnDItemInterface::MoveDrop)
                reshowWidgets.push_back(w);

    const Qt::DropAction executedAction = drag->exec(Qt::CopyAction|Qt::MoveAction, mimeData->proposedDropAction());

    if (executedAction == Qt::IgnoreAction && !reshowWidgets.empty())
        foreach (QWidget *w, reshowWidgets)
            w->show();

    return executedAction;
}
开发者ID:hkahn,项目名称:qt5-qttools-nacl,代码行数:24,代码来源:qdesigner_dnditem.cpp

示例3: getAbsoluteWidget

///
///returns a widget
///it supports repeated widget names
///
QWidget* getAbsoluteWidget(QStringList path)
{
    _log::misc << "(QWidgetUtils::getAbsoluteWidget)" << std::endl;
    ///update the view
    QWidgetUtils::updateAppView();

    ///get all the widgets
    QWidgetList qwl = qApp->allWidgets();

    ///get the widget name
    assert ( path.size() );
    QString name = path.back();
    if ( name == "" )
    {
        std::cout << "(QWidgetUtils::getAbsoluteWidget) ERROR. The name of the widget is empty." << std::endl;
        return NULL;
    }
    path.pop_back();

    //_log::misc << "(QWidgetUtils::getAbsoluteWidget) Name = " << name.toStdString() << std::endl;


    ///get all widgets with this name
    QWidgetList qws;
    foreach ( QWidget *w, qwl )
    {
        if ( getWidgetName ( w ) == name )
        {
            qws.push_back ( w );
        }
    }
    //_log::misc << "(QWidgetUtils::getAbsoluteWidget) OK" << std::endl;
    //if there are no selected widgets...
    if ( qws.size() == 0 )
    {
        _log::misc << "(QWidgetUtils::getAbsoluteWidget) ERROR. There are no selected widgets." << std::endl;
        return NULL;
    }
    //_log::misc << "(QWidgetUtils::getAbsoluteWidget) OK" << std::endl;

    ///get the concrete widget we are looking for...
    int level = 1;
    bool onTopLevel = false;
    int onTopLevelCount = 0;
    QWidgetList::iterator qit;

    /*for (qit = qws.begin(); qit != qws.end(); qit++)
      {
      QWidget* w = static_cast<QWidget*> ( *qit );
      _log::misc << getWidgetPath(w).toStdString() << std::endl;
      }*/

    // while more than 1 widget remaining
    // or every widget has been analyzed...
    while ( qws.size() > 1 && onTopLevelCount < qws.size() )
    {

        //_log::misc << "(QWidgetUtils::getAbsoluteWidget) OK -> " << qws.size() << std::endl;
        //for the remaining widgets...
        qit = qws.begin();
        while ( qit != qws.end() )
        {
            //get the parent widget
            QWidget* w = static_cast<QWidget*> ( *qit );
            QWidget* wParent = w;
            assert ( wParent );
            onTopLevel = false;

            for ( int i = 0; i < level; i++ )
            {
                //if we are in a top level widget (with no parent node)
                //we have to avoid this widget
                if ( wParent->parent() == NULL )
                {
                    onTopLevel = true;
                    onTopLevelCount++;
                    break;
                }
                //if not, we go on looking for up
                else
                {
                    wParent = static_cast<QWidget*> ( wParent->parent() );
                }
            }

            //if not at top level...
            if ( !onTopLevel )
            {
                //we chech the parent name and delete the
                //widgets whose parent name does not mach
                if ( getWidgetName ( wParent ) != path.back() )
                {
                    qit = qws.erase ( qit );
                }
                else
                {
//.........这里部分代码省略.........
开发者ID:catedrasaes-umu,项目名称:sdaver_qtlua_v2,代码行数:101,代码来源:qt_widget_utils.cpp


注:本文中的QWidgetList::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。