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


C++ QObjectList::isEmpty方法代码示例

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


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

示例1: insertMenu

void MenuItemMgr::insertMenu( Qtitan::RibbonGroup* rGroup , QWidgetAction* item )
{
	QObjectList::iterator it ;

	QActionGroup* pActionGroup = myMainWindow->getActionGroup() ;
	Q_ASSERT( pActionGroup!= NULL ) ;

	QObjectList menuitems = item->children() ;
	if( menuitems.isEmpty() )
		return  ;

	for( it = menuitems.begin() ; it != menuitems.end() ; it++ )
	{
		QWidgetAction *wa = (QWidgetAction*)*it ; 
		if( wa->children().isEmpty() )
		{
			// 不含有子菜单
			//QAction* action = rGroup->addAction( wa->icon(), 
			//	              wa->text(), Qt::ToolButtonTextUnderIcon);
			rGroup->addAction(wa, Qt::ToolButtonTextUnderIcon);
			registerAction( wa ) ;
			pActionGroup->addAction( wa ) ;
            
		}
		else
		{
			// 含有子菜单
			 QMenu* menuPopup = rGroup->addMenu( wa->icon(), 
				 wa->text() , Qt::ToolButtonTextUnderIcon);

			insertMenu( menuPopup , wa ) ;
		}
	}

}
开发者ID:ijab,项目名称:SpeechNav,代码行数:35,代码来源:MenuItemMgr.cpp

示例2: loadFromPlugin

AbstractView* ViewLoader::loadFromPlugin(AbstractView *currentView, const QString &menuAction)
{
	AbstractView *view = nullptr;

	// Other views loaded from plugins
	QMultiMap<QString, QObject*> multiMap = _pluginManager->dependencies();
	QObjectList dep = multiMap.values(menuAction);
	if (dep.isEmpty()) {
		return view;
	}
	qDebug() << Q_FUNC_INFO << "No built-in view was found for this action. Was it from an external plugin?";
	for (BasicPlugin *plugin : _pluginManager->loadedPlugins().values()) {
		if (plugin->name() != menuAction) {
			continue;
		}

		// Check if we need to pass some objects from old view to new view, because new one can be brought by plugins
		// For example, a plugin may need the MediaPlayerControl from the current view
		if (MediaPlayerPlugin *mediaPlayerPlugin = qobject_cast<MediaPlayerPlugin*>(plugin)) {
			mediaPlayerPlugin->setMediaPlayerControl(currentView->mediaPlayerControl());
			if (mediaPlayerPlugin->hasView()) {
				view = mediaPlayerPlugin->instanciateView();
				view->setOrigin(currentView);
			}
		}
	}
	return view;
}
开发者ID:percevall,项目名称:Miam-Player,代码行数:28,代码来源:viewloader.cpp

示例3: raise_sys

void QWidgetPrivate::raise_sys()
{
    Q_Q(QWidget);
    //@@@ transaction
    if (q->isWindow()) {
        Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
        QWidget::qwsDisplay()->setAltitude(q->internalWinId(),
                                           QWSChangeAltitudeCommand::Raise);
        // XXX: subsurfaces?
#ifdef QT_NO_WINDOWGROUPHINT
#else
        QObjectList childObjects =  q->children();
        if (!childObjects.isEmpty()) {
            QWidgetList toraise;
            for (int i = 0; i < childObjects.size(); ++i) {
                QObject *obj = childObjects.at(i);
                if (obj->isWidgetType()) {
                    QWidget* w = static_cast<QWidget*>(obj);
                    if (w->isWindow())
                        toraise.append(w);
                }
            }

            for (int i = 0; i < toraise.size(); ++i) {
                QWidget *w = toraise.at(i);
                if (w->isVisible())
                    w->raise();
            }
        }
#endif // QT_NO_WINDOWGROUPHINT
    }
}
开发者ID:Afreeca,项目名称:qt,代码行数:32,代码来源:qwidget_qws.cpp

示例4: appendLeaves

void NameList::appendLeaves(QObject *object) {
    QObjectList children = object->children();
    if (children.isEmpty())
        leaves.append(object);
    else for (int i = 0; i < children.size(); ++i) {
        appendLeaves(children[i]);
    }
}
开发者ID:getachewf,项目名称:UniSim,代码行数:8,代码来源:name_list.cpp

示例5: ArbiterWidget

void 
PatternWidgetClass::init()
{
  // delete all childs
  QObjectList * childs;
  while((childs =  const_cast<QObjectList *>(this->children())) != NULL && 
	!childs->isEmpty()) {
    delete childs->first();
  }

  // resize widget //
  int numBehaviours = getDocument().getNumBehaviours(patternName);
  setFixedSize(100,
	       PATTERN_NAME_HEIGHT + 
	       BEHAVIOUR_NAME_HEIGHT * numBehaviours + 
	       ARBITER_NAME_HEIGHT +
	       2*frameWidth());

  // get internal rect dimensions (inside the frame) //
  QRect cr = contentsRect();


  //----------------//
  // behaviour list //
  //----------------//

   // get string list with behaviour names //
   QStringList list = getDocument().getBehaviourNames(patternName);

   // show all behaviour names //
   int i = 0;
   for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) {
     QString behName = (*it);

     // create new label //
     BehaviourWidget* behWidget = new BehaviourWidget(this, behName);
     behWidget->setGeometry(cr.x(), 
			    cr.y()+PATTERN_NAME_HEIGHT+i*BEHAVIOUR_NAME_HEIGHT,
			    cr.width(), BEHAVIOUR_NAME_HEIGHT);  
     behWidget->show();

     i++;
   }


  //---------//
  // arbiter //
  //---------//

  ArbiterWidget * arbiterWidget = 
    new ArbiterWidget(this, getDocument().getArbiter(patternName));
  arbiterWidget->setGeometry(cr.x(), cr.y()+cr.height()-ARBITER_NAME_HEIGHT, 
			     cr.width(), ARBITER_NAME_HEIGHT);  
  arbiterWidget->show();

  update();
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:57,代码来源:PatternWidget.cpp

示例6: subfolders

QStringList Folder::subfolders() {
  QStringList subFolderList = QStringList();
  QObjectList folderList = children();
  if (!folderList.isEmpty()) {
    QObject *folder;
    foreach (folder, folderList)
      subFolderList << static_cast<Folder *>(folder)->name();
  }
  return subFolderList;
}
开发者ID:narunlifescience,项目名称:AlphaPlot,代码行数:10,代码来源:Folder.cpp

示例7: setModified

void
DocumentXML::clear()
{
  document_.removeChild(document_.documentElement());
  setModified(true);

  if(!children().isEmpty()) {
    QObjectList childList = children();
    while(!childList.isEmpty()) {
      delete childList.takeFirst();
    }
  }
}
开发者ID:BackupTheBerlios,项目名称:miro-middleware-svn,代码行数:13,代码来源:DocumentXML.cpp

示例8: adjustAppearanceToOS

// from: http://stackoverflow.com/questions/5298614/change-the-size-of-qt-dialogs-depending-on-the-platform
void MainWindow::adjustAppearanceToOS(QWidget *rootWidget)
{
    int fontSize = -1;
    #ifdef Q_OS_WIN
        fontSize = 8;
    #elif __APPLE__
        fontSize = 12;
    #elif __linux
        fontSize = 11;
    #endif

    if (rootWidget == NULL)
        return;

    QObject *child = NULL;
    QObjectList Containers;
    QObject *container  = NULL;
    QStringList DoNotAffect;

    // Make an exception list (Objects not to be affected)
    // DoNotAffect.append("widgetName");

    // Append root to containers
    Containers.append(rootWidget);

    while (!Containers.isEmpty())
    {
        container = Containers.takeFirst();
        if (container != NULL)
            for (int i = 0; i < container->children().size(); i++)
            {
                child = container->children()[i];
                if (!child->isWidgetType() || DoNotAffect.contains(child->objectName()))
                    continue;

                if (child->children().size() > 0)
                    Containers.append(child);

                // (if the object is not of the correct type, it will be NULL)
                QLabel *label = qobject_cast<QLabel *>(child);
                if (label != NULL)
                {
                    label->setText(label->text().replace(QRegExp("font-size:.*;"), ""));

                    QFont font = label->font();
                    font.setPointSize(fontSize);
                    label->setFont(font);
                }
            }
    }
}
开发者ID:changbiao,项目名称:XDBF-Manager,代码行数:52,代码来源:mainwindow.cpp

示例9: layout

/*!
    Changes the layout of the group box. This function is only useful
    in combination with the default constructor that does not take any
    layout information. This function will put all existing children
    in the new layout. It is not good Qt programming style to call
    this function after children have been inserted. Sets the number
    of columns or rows to be \a strips, depending on \a direction.

    \sa orientation columns
*/
void Q3GroupBox::setColumnLayout(int strips, Qt::Orientation direction)
{
    if (layout())
        delete layout();

    d->vbox = 0;
    d->grid = 0;

    if (strips < 0) // if 0, we create the d->vbox but not the d->grid. See below.
        return;

    d->vbox = new QVBoxLayout(this, d->marg, 0);

    d->nCols = 0;
    d->nRows = 0;
    d->dir = direction;

    // Send all child events and ignore them. Otherwise we will end up
    // with doubled insertion. This won't do anything because d->nCols ==
    // d->nRows == 0.
    QApplication::sendPostedEvents(this, QEvent::ChildInserted);

    // if 0 or smaller , create a vbox-layout but no grid. This allows
    // the designer to handle its own grid layout in a group box.
    if (strips <= 0)
        return;

    d->dir = direction;
    if (d->dir == Qt::Horizontal) {
        d->nCols = strips;
        d->nRows = 1;
    } else {
        d->nCols = 1;
        d->nRows = strips;
    }
    d->grid = new QGridLayout(d->nRows, d->nCols, d->spac);
    d->row = d->col = 0;
    d->grid->setAlignment(Qt::AlignTop);
    d->vbox->addLayout(d->grid);

    // Add all children
    QObjectList childList = children();
    if (!childList.isEmpty()) {
        for (int i = 0; i < childList.size(); ++i) {
            QObject *o = childList.at(i);
            if (o->isWidgetType() && o != d->checkbox)
                insertWid(static_cast<QWidget *>(o));
        }
    }
}
开发者ID:Fale,项目名称:qtmoko,代码行数:60,代码来源:q3groupbox.cpp

示例10: currentPage

DlgPreferencePage* DlgPreferences::currentPage() {
    QObject* pObject = pagesWidget->currentWidget();
    for (int i = 0; i < 2; ++i) {
        if (pObject == NULL) {
            return NULL;
        }
        QObjectList children = pObject->children();
        if (children.isEmpty()) {
            return NULL;
        }
        pObject = children[0];
    }
    return dynamic_cast<DlgPreferencePage*>(pObject);
}
开发者ID:WaylonR,项目名称:mixxx,代码行数:14,代码来源:dlgpreferences.cpp

示例11: while

//----------------------------------------------------------------------------
ctkCmdLineModuleObjectTreeWalker::TokenType ctkCmdLineModuleObjectTreeWalker::readNext()
{
  if (AtEnd) return NoToken;

  QObject* curr = 0;
  if (CurrentObject == 0)
  {
    curr = RootObject;
    if (setCurrent(curr)) return CurrentToken;
  }
  else
  {
    curr = CurrentObject;
  }

  while (true)
  {
    if (curr)
    {
      QObjectList children = curr->children();
      QListIterator<QObject*> i(children);
      i.toBack();
      while (i.hasPrevious())
      {
        ObjectStack.push(i.previous());
      }
      if (children.isEmpty())
      {
        curr = 0;
      }
      else
      {
        curr = ObjectStack.pop();
        if (setCurrent(curr)) return CurrentToken;
      }
      continue;
    }

    if (ObjectStack.isEmpty()) break;
    curr = ObjectStack.pop();
    if (setCurrent(curr)) return CurrentToken;
  }

  AtEnd = true;
  CurrentObject = 0;
  CurrentToken = NoToken;

  return NoToken;
}
开发者ID:151706061,项目名称:CTK,代码行数:50,代码来源:ctkCmdLineModuleObjectTreeWalker.cpp

示例12: deleteAllSubuis

void YGWidget::deleteAllSubuis()
{
    QObjectList childList = children();
    if(!childList.isEmpty())
    {
        for (int i = 0; i < childList.size(); ++i)
        {
            YGWidget* wgt = qobject_cast<YGWidget*>(childList.at(i));
            if(wgt)
            {
                wgt->deleteLater();
            }
        }
    }
}
开发者ID:JandunCN,项目名称:AllInGithub,代码行数:15,代码来源:ygwidget.cpp

示例13: deleteMsgBox

void YGWidget::deleteMsgBox()
{
    QObjectList childList = children();
    if(!childList.isEmpty())
    {
        for (int i = 0; i < childList.size(); ++i)
        {
            YGMsgBox* wgt = qobject_cast<YGMsgBox*>(childList.at(i));
            if(wgt)
            {
                //wgt->finished();
            }
        }
    }
}
开发者ID:JandunCN,项目名称:AllInGithub,代码行数:15,代码来源:ygwidget.cpp

示例14: children

Item::~Item()
{
  //  cout << name() << " deleting children" << endl;

  if (!children().isEmpty()) {
    QObjectList childList = children();
    while(!childList.isEmpty() ) {
      delete childList.takeFirst();
    }
  }

  //  cout << name() << " deleting listviewitem" << endl;

  delete treeWidgetItem_;
  // Remove the QTreeWidgetItem from the map to Item
  itemMap_.erase(treeWidgetItem_);

  //  cout << name() << " deleting" << endl;
}
开发者ID:hhutz,项目名称:Miro,代码行数:19,代码来源:Item.cpp

示例15: completeQObject

void QSAEditor::completeQObject(const QVector<QObject *> &objects,
                                    const QString &object,
                                    QVector<CompletionEntry> &res)
{
    for ( int i = 0; i < objects.count(); i++ ) {
        QObject *qobj = objects[ i ];
        if ( !qobj )
            continue;
        // children
        QObjectList clist;
        if ( qobj == qApp )
            clist = interpreter()->topLevelObjects() != 0 ?
                    *((QObjectList*)interpreter()->topLevelObjects()) :
                    QObjectList();
        else
            clist = qobj->children();

        if ( !clist.isEmpty() ) {
            for (int ci = 0; ci<clist.size(); ++ci) {
                const QObject *o = clist.at(ci);
                CompletionEntry c;
                c.type = o->isWidgetType() ? "widget" : "object";
                c.text = o->objectName();
                c.postfix2 = o->metaObject()->className();
                if ( !c.postfix2.isEmpty() )
                    c.postfix2.prepend( QString::fromLatin1(" : ") );
                res << c;
            }
        }

        QSObject qsobj = interpreter()->wrap( qobj );
        int flags = 0;
        if ( i == 0 )
            flags |= IncludeSuperClass;
        completeQMetaObject( qobj->metaObject(),
                             object,
                             res,
                             flags,
                             qsobj
                             );

    }
}
开发者ID:aschet,项目名称:qsaqt5,代码行数:43,代码来源:qsaeditor.cpp


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