本文整理汇总了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 ) ;
}
}
}
示例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;
}
示例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
}
}
示例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]);
}
}
示例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();
}
示例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;
}
示例7: setModified
void
DocumentXML::clear()
{
document_.removeChild(document_.documentElement());
setModified(true);
if(!children().isEmpty()) {
QObjectList childList = children();
while(!childList.isEmpty()) {
delete childList.takeFirst();
}
}
}
示例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);
}
}
}
}
示例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));
}
}
}
示例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);
}
示例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;
}
示例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();
}
}
}
}
示例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();
}
}
}
}
示例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;
}
示例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
);
}
}