本文整理汇总了C++中QObjectList类的典型用法代码示例。如果您正苦于以下问题:C++ QObjectList类的具体用法?C++ QObjectList怎么用?C++ QObjectList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QObjectList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: children
/*!
\internal
*/
void QDeclarativeGeoMap::populateMap()
{
QObjectList kids = children();
for (int i = 0; i < kids.size(); ++i) {
// dispatch items appropriately
QDeclarativeGeoMapItemView *mapView = qobject_cast<QDeclarativeGeoMapItemView *>(kids.at(i));
if (mapView) {
m_mapViews.append(mapView);
setupMapView(mapView);
continue;
}
QDeclarativeGeoMapItemBase *mapItem = qobject_cast<QDeclarativeGeoMapItemBase *>(kids.at(i));
if (mapItem) {
addMapItem(mapItem);
}
}
}
示例2: SetFont
void FontHelper::SetFont(QWidget * w)
{
#ifndef Q_OS_MAC
QObjectList widgetList = w->children();
for (int k = 0, sz = widgetList.size(); k < sz; ++k)
{
QWidget * tw = dynamic_cast<QWidget*>(widgetList[k]);
if (tw)
{
int pt = tw->fontInfo().pointSize();
bool bold = tw->fontInfo().bold();
tw->setFont(FontHelper::pt(pt, bold));
SetFont(tw);
}
}
#endif // Q_OS_MAC
}
示例3: children
/*!
\internal
*/
void QDeclarativeGeoMap::onMapChildrenChanged()
{
if (!m_componentCompleted || !m_mappingManagerInitialized)
return;
int maxChildZ = 0;
QObjectList kids = children();
bool foundCopyrights = false;
for (int i = 0; i < kids.size(); ++i) {
QDeclarativeGeoMapCopyrightNotice *copyrights = qobject_cast<QDeclarativeGeoMapCopyrightNotice *>(kids.at(i));
if (copyrights) {
foundCopyrights = true;
} else {
QDeclarativeGeoMapItemBase *mapItem = qobject_cast<QDeclarativeGeoMapItemBase *>(kids.at(i));
if (mapItem) {
if (mapItem->z() > maxChildZ)
maxChildZ = mapItem->z();
}
}
}
QDeclarativeGeoMapCopyrightNotice *copyrights = m_copyrights.data();
// if copyrights object not found within the map's children
if (!foundCopyrights) {
// if copyrights object was deleted!
if (!copyrights) {
// create a new one and set its parent, re-assign it to the weak pointer, then connect the copyrights-change signal
m_copyrights = new QDeclarativeGeoMapCopyrightNotice(this);
copyrights = m_copyrights.data();
connect(m_map, SIGNAL(copyrightsChanged(QImage)),
copyrights, SLOT(copyrightsChanged(QImage)));
connect(m_map, SIGNAL(copyrightsChanged(QString)),
copyrights, SLOT(copyrightsChanged(QString)));
connect(copyrights, SIGNAL(linkActivated(QString)),
this, SIGNAL(copyrightLinkActivated(QString)));
} else {
// just re-set its parent.
copyrights->setParent(this);
}
}
// put the copyrights notice object at the highest z order
copyrights->setCopyrightsZ(maxChildZ + 1);
}
示例4: activePickers
static QVector<QwtPicker *> activePickers( QWidget *w )
{
QVector<QwtPicker *> pickers;
QObjectList children = w->children();
for ( int i = 0; i < children.size(); i++ )
{
QObject *obj = children[i];
if ( obj->inherits( "QwtPicker" ) )
{
QwtPicker *picker = ( QwtPicker * )obj;
if ( picker->isEnabled() )
pickers += picker;
}
}
return pickers;
}
示例5: do_cls
void MvcpThread::do_cls(mvcp a_mvcp, QObject* parent)
{
QObjectList* result = new QObjectList;
mvcp_dir dir = mvcp_dir_init(a_mvcp, parent->property("path").toString().toUtf8().constData());
int n = mvcp_dir_count(dir);
for (int i = 0; i < n; i++) {
mvcp_dir_entry_t entry;
mvcp_dir_get(dir, i, &entry);
QObject* o = new QObject;
o->setObjectName(QString::fromUtf8(entry.full));
o->setProperty("name", QString::fromUtf8(entry.name));
o->setProperty("dir", entry.dir);
o->setProperty("size", entry.size);
result->append(o);
}
mvcp_dir_close(dir);
emit clsResult(parent, result);
}
示例6: sizeToString
QString Folder::sizeToString()
{
int size = 0;
QObjectList* folderLst = (QObjectList*)children();
if (folderLst)
{
Folder *f;
for (f = (Folder*)folderLst->first(); f; f = (Folder*)folderLst->next())
size += sizeof(f);
}
myWidget *w;
for (w = lstWindows.first(); w ; w = lstWindows.next())
size += sizeof(w);
return QString::number(8*size/1024.0,'f',1)+" "+tr("kB")+" ("+QString::number(8*size)+" "+tr("bytes")+")";
}
示例7: QMenuBar
QMenuBar * QMainWindow::menuBar() const
{
if ( d->mb )
return d->mb;
QObjectList * l
= ((QObject*)this)->queryList( "QMenuBar", 0, FALSE, FALSE );
QMenuBar * b;
if ( l && l->count() )
b = (QMenuBar *)l->first();
else
b = new QMenuBar( (QMainWindow *)this, "automatic menu bar" );
delete l;
((QMainWindowPrivate*)d)->mb = b;
d->mb->installEventFilter( this );
((QMainWindow *)this)->triggerLayout();
return b;
}
示例8: children
bool Task::take(const QDomElement &x)
{
const QObjectList p = children();
// pass along the xml
Task *t;
for(QObjectList::ConstIterator it = p.begin(); it != p.end(); ++it) {
QObject *obj = *it;
if(!obj->inherits("XMPP::Task"))
continue;
t = static_cast<Task*>(obj);
if(t->take(x))
return true;
}
return false;
}
示例9: timerHit
void MainWindow::timerHit()
{
QObjectList objList = this->children();
for(int i = 0; i < objList.size(); i++)
{
if (dynamic_cast<View*>(objList.at(i)) != 0 )
{
dynamic_cast<View*>(objList.at(i))->Update(game->getScreen(), game->getBBS(), game->getSS());
}
}
if (game->Collision(j,s, game->getObjects().back()->get_y()) && !c)
{
timer->stop();
nameline = new QLineEdit(this);
nameline->move(this->width()/2 - 50, this->height()/2 - 50);
nameline->setPlaceholderText("Enter your name here.");
nameline->show();
scorebutton = new QPushButton("Save Scores", this);
scorebutton->move(this->width()/2 - 50, this->height()/2 + 50);
connect(scorebutton, SIGNAL(clicked()), this, SLOT(savescorebutton_clicked()));
scorebutton->show();
newgame = new QPushButton("Restart?", this);
newgame->move(this->width()/2 - 150, this->height()/2);
connect(newgame, SIGNAL(clicked()), this, SLOT(restart_clicked()));
newgame->show();
endgame = new QPushButton("End Game?", this);
endgame->move(this->width()/2 + 50, this->height()/2);
connect(endgame, SIGNAL(clicked()), this, SLOT(endgame_clicked()));
endgame->show();
//QMessageBox::critical(this, "Game Over...", "You have died!");
}
scoresheet.incScore();
int score = scoresheet.getScore();
QString scorey = QString::number(score);
scorelabel->setText(scorey);
scorelabel->show();
}
示例10: interpreter
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
);
}
}
示例11: 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;
}
示例12: QGroupBox
IPCamSetting::IPCamSetting(QWidget *parent) :
QGroupBox(parent),
ui(new Ui::IPCamSetting)
{
ui->setupUi(this);
QObjectList objList = this->children();
QObjectList::iterator objIter = objList.begin(), objEnd = objList.end();
QObjectList::iterator lineEditIter = objList.begin();
IsInherit predLabel("QLabel"), predLineEdit("QLineEdit");
while ((objIter = std::find_if(objIter, objEnd, predLabel)) != objEnd) {
lineEditIter = std::find_if(lineEditIter, objEnd, predLineEdit);
if (lineEditIter != objEnd) {
m_mapLabelToLineEdit.insert(dynamic_cast<QLabel*>(*objIter)->text(),
dynamic_cast<QLineEdit*>(*lineEditIter));
++lineEditIter;
}
++objIter;
}
}
示例13: QSize
/*! Returns true if any of the child QWidgets has different minimum and maximum
sizes, as set by qt_ui_element_rep::as_qwidget() for resize_widgets.
*/
bool
qt_window_widget_rep::has_resizable_children (QWidget* w, bool ret) {
// Ignore any non QWidgets
if (!w) return false;
// Hack: these must always be resizable
if (qobject_cast<QMainWindow*> (w) || qobject_cast<QDockWidget*> (w))
return true;
ret = (w->minimumSize() != QSize (0,0) &&
w->maximumSize() != QSize (QWIDGETSIZE_MAX, QWIDGETSIZE_MAX) &&
w->minimumSize() != w->maximumSize());
QObjectList ch = w->children();
for (int i=0; i<ch.size(); ++i)
ret = ret || has_resizable_children (qobject_cast<QWidget*> (ch[i]), ret);
return ret;
}
示例14: eventFilter
bool SGMainWindowEvent::eventFilter(QObject* object, QEvent* evt) {
QWidget* focusWidget = QApplication::focusWidget();
if (focusWidget == NULL) return true;
if (m_focusWidgetName == focusWidget->objectName().toStdString().c_str()) return QObject::eventFilter(object, evt);
QObjectList objList = focusWidget->children();
bool glWidgetExists = false;
for (int i = 0; i < objList.length(); i++) {
QWidget* widget = (QWidget*)objList[i];
QObjectList objList2 = widget->children();
for (int j = 0; j < objList2.length(); j++) {
QWidget* widget2 = (QWidget*)objList2[j];
if (strcmp(widget2->metaObject()->className(), "QmayaGLWidget") == 0) {
if (m_beforeWidget != NULL) {
m_beforeWidget->releaseKeyboard();
m_beforeWidget->removeEventFilter(toolEvent);
}
widget2->installEventFilter(toolEvent);
widget2->grabKeyboard();
m_beforeWidget = widget2;
m_focusWidgetName = focusWidget->objectName().toStdString().c_str();
glWidgetExists = true;
SGKey::initializeKeys();
SGMouse::initializeButtons();
break;
}
}
if (glWidgetExists)break;
}
if (!glWidgetExists) {
if (m_beforeWidget != NULL) {
m_beforeWidget->releaseKeyboard();
m_beforeWidget->removeEventFilter(toolEvent);
}
m_focusWidgetName = focusWidget->objectName().toStdString().c_str();
}
return QObject::eventFilter(object, evt);
}
示例15: Q_Q
/*
sets all children of the group box except the qt_groupbox_checkbox
to either disabled/enabled
*/
void QGroupBoxPrivate::_q_setChildrenEnabled(bool b)
{
Q_Q(QGroupBox);
QObjectList childList = q->children();
for (int i = 0; i < childList.size(); ++i) {
QObject *o = childList.at(i);
if (o->isWidgetType()) {
QWidget *w = static_cast<QWidget *>(o);
if (b) {
if (!w->testAttribute(Qt::WA_ForceDisabled))
w->setEnabled(true);
} else {
if (w->isEnabled()) {
w->setEnabled(false);
w->setAttribute(Qt::WA_ForceDisabled, false);
}
}
}
}
}