本文整理汇总了C++中QObjectList::at方法的典型用法代码示例。如果您正苦于以下问题:C++ QObjectList::at方法的具体用法?C++ QObjectList::at怎么用?C++ QObjectList::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QObjectList
的用法示例。
在下文中一共展示了QObjectList::at方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enableToolBar
void DkTransferToolBar::enableToolBar(bool enable) {
QObjectList list = this->children();
for (int i = 0; i < list.count(); i++) {
if (QWidget *action = qobject_cast<QWidget*>(list.at(i)))
action->setEnabled(enable);
}
if (enable)
mEffect->setOpacity(1);
else
mEffect->setOpacity(.5);
}
示例2: 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();
}
}
}
}
示例3: setWindowStatus
void MainWindow::setWindowStatus()
{
//Set window title
QString title;
//title = QString("%1").arg(CInfo::AppNameShort());
title = QString("Visualize and Process");
setWindowTitle(title);
//Set status bar
//Set data file informations
if(m_pDataWindow->getDataModel()->m_bFileloaded) {
int idx = m_qFileRaw.fileName().lastIndexOf("/");
QString filename = m_qFileRaw.fileName().remove(0,idx+1);
title = QString("Data file: %1 / First sample: %2 / Sample frequency: %3Hz").arg(filename).arg(m_pDataWindow->getDataModel()->firstSample()).arg(m_pDataWindow->getDataModel()->m_fiffInfo.sfreq);
}
else
title = QString("No data file");
//Set event file informations
if(m_pEventWindow->getEventModel()->m_bFileloaded) {
int idx = m_qEventFile.fileName().lastIndexOf("/");
QString filename = m_qEventFile.fileName().remove(0,idx+1);
title.append(QString(" - Event file: %1").arg(filename));
}
else
title.append(" - No event file");
//Set evoked file informations
if(m_pAverageWindow->getAverageModel()->m_bFileloaded) {
int idx = m_qEvokedFile.fileName().lastIndexOf("/");
QString filename = m_qEvokedFile.fileName().remove(0,idx+1);
title.append(QString(" - Evoked file: %1").arg(filename));
}
else
title.append(" - No evoked file");
//Add permanent widget to status bar after deleting old one
QObjectList cildrenList = statusBar()->children();
for(int i = 0; i< cildrenList.size(); i++)
statusBar()->removeWidget((QWidget*)cildrenList.at(i));
QLabel* label = new QLabel(title);
statusBar()->addWidget(label);
}
示例4: isChildOf
static bool isChildOf(QWidget* child, QWidget *parent)
{
if (!child)
return false;
QObjectList list = parent->children();
for (int i = 0; i < list.size(); ++i) {
QObject *obj = list.at(i);
if (!obj->isWidgetType())
continue;
QWidget *widget = static_cast<QWidget *>(obj);
if (!widget->isWindow())
continue;
if (widget == child || isChildOf(child, widget))
return true;
}
return false;
}
示例5: 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
);
}
}
示例6: _q_setChildrenEnabled
/*
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);
}
}
}
}
}
示例7: sizeHint
/*!
\reimp
*/
QSize QSplitter::sizeHint() const
{
Q_D(const QSplitter);
ensurePolished();
int l = 0;
int t = 0;
QObjectList childList = children();
for (int i = 0; i < childList.size(); ++i) {
if (QWidget *w = qobject_cast<QWidget *>(childList.at(i))) {
if (w->isHidden())
continue;
QSize s = w->sizeHint();
if (s.isValid()) {
l += d->pick(s);
t = qMax(t, d->trans(s));
}
}
}
return orientation() == Qt::Horizontal ? QSize(l, t) : QSize(t, l);
}
示例8: setDefaultFontSize
void WidgetSizeHelper::setDefaultFontSize(QWidget* pWidget) {
// we get all of pWidget's children
QObjectList children = pWidget->children();
// for each child
for ( int i = 0; i < children.length(); i++ ) {
/*
* we change its font size if it is of one of those types
*
* - QLabel
* - QLineEdit
* - QRadioButton
* - QGroupBox
* - QCheckBox
* - QStatusBar
*/
QWidget* pChild = static_cast<QWidget*> ( children.at(i) );
if ( qobject_cast<QLabel*>(pChild) != NULL ||
qobject_cast<QLineEdit*>(pChild) != NULL ||
qobject_cast<QRadioButton*>(pChild) != NULL ||
qobject_cast<QGroupBox*>(pChild) != NULL ||
qobject_cast<QCheckBox*>(pChild) != NULL ||
qobject_cast<QStatusBar*>(pChild) != NULL )
{
QFont lFont = pChild->font();
lFont.setPointSize(Constants::MAC_FONT_SIZE);
pChild->setFont(lFont);
}
// and scan it, if it has children
if ( ! pChild->children().isEmpty() ) {
setDefaultFontSize( pChild );
}
}
}
示例9: setupStatusBar
void BasketStatusBar::setupStatusBar()
{
QWidget* parent = statusBar();
QObjectList lst = parent->findChildren<QObject*>("KRSqueezedTextLabel");
//Tools::printChildren(parent);
if (lst.count() == 0) {
m_basketStatus = new QLabel(parent);
QSizePolicy policy(QSizePolicy::Ignored, QSizePolicy::Ignored);
policy.setHorizontalStretch(0);
policy.setVerticalStretch(0);
policy.setHeightForWidth(false);
m_basketStatus->setSizePolicy(policy);
addWidget(m_basketStatus, 1, false); // Fit all extra space and is hiddable
} else
m_basketStatus = static_cast<QLabel*>(lst.at(0));
lst.clear();
m_selectionStatus = new QLabel(i18n("Loading..."), parent);
addWidget(m_selectionStatus, 0, true);
m_lockStatus = new QLabel(0/*this*/);
m_lockStatus->setMinimumSize(18, 18);
m_lockStatus->setAlignment(Qt::AlignCenter);
// addWidget( m_lockStatus, 0, true );
m_lockStatus->installEventFilter(this);
m_savedStatusPixmap = SmallIcon("document-save");
m_savedStatus = new QLabel(parent);
m_savedStatus->setPixmap(m_savedStatusPixmap);
m_savedStatus->setFixedSize(m_savedStatus->sizeHint());
m_savedStatus->clear();
//m_savedStatus->setPixmap(m_savedStatusIconSet.pixmap(QIconSet::Small, QIconSet::Disabled));
//m_savedStatus->setEnabled(false);
addWidget(m_savedStatus, 0, true);
m_savedStatus->setToolTip("<p>" + i18n("Shows if there are changes that have not yet been saved."));
}
示例10: setMouseCursor
void QWidgetResizeHandler::setMouseCursor(MousePosition m)
{
#ifdef QT_NO_CURSOR
Q_UNUSED(m);
#else
QObjectList children = widget->children();
for (int i = 0; i < children.size(); ++i) {
if (QWidget *w = qobject_cast<QWidget*>(children.at(i))) {
if (!w->testAttribute(Qt::WA_SetCursor)) {
w->setCursor(Qt::ArrowCursor);
}
}
}
switch (m) {
case TopLeft:
case BottomRight:
widget->setCursor(Qt::SizeFDiagCursor);
break;
case BottomLeft:
case TopRight:
widget->setCursor(Qt::SizeBDiagCursor);
break;
case Top:
case Bottom:
widget->setCursor(Qt::SizeVerCursor);
break;
case Left:
case Right:
widget->setCursor(Qt::SizeHorCursor);
break;
default:
widget->setCursor(Qt::ArrowCursor);
break;
}
#endif // QT_NO_CURSOR
}
示例11: buddyString
static QString buddyString(const QWidget *widget)
{
if (!widget)
return QString();
QWidget *parent = widget->parentWidget();
if (!parent)
return QString();
#ifndef QT_NO_SHORTCUT
QObjectList ol = parent->children();
for (int i = 0; i < ol.size(); ++i) {
QLabel *label = qobject_cast<QLabel*>(ol.at(i));
if (label && label->buddy() == widget)
return label->text();
}
#endif
#ifndef QT_NO_GROUPBOX
QGroupBox *groupbox = qobject_cast<QGroupBox*>(parent);
if (groupbox)
return groupbox->title();
#endif
return QString();
}
示例12: children
/*!
\reimp
*/
void Q3WidgetStack::setVisible(bool visible)
{
if (visible) {
// Reimplemented in order to set the children's geometries
// appropriately and to pick the first widget as d->topWidget if no
// topwidget was defined
QObjectList c = children();
if (!isVisible() && !c.isEmpty()) {
for (int i = 0; i < c.size(); ++i) {
QObject * o = c.at(i);
if (o->isWidgetType()) {
if (!topWidget && o != invisible)
topWidget = static_cast<QWidget*>(o);
if (o == topWidget)
static_cast<QWidget *>(o)->show();
else
static_cast<QWidget *>(o)->hide();
}
}
setChildGeometries();
}
}
Q3Frame::setVisible(visible);
}
示例13: groupUnits
/*!
Creates an unit group. Usually done with CTRL+number.
*/
void CcfQmlBaseScenario::groupUnits(int groupNumber)
{
if ((groupNumber < 0) || (selectedUnitsCount() == 0)) {
return;
}
// Remove old members.
if (groupNumber < mUnitGroups.count()) {
for (int i = 0; i < mUnitGroups.value(groupNumber).length(); ++i) {
if (mUnitGroups.value(groupNumber).at(i)->getBool("selected") == false)
mUnitGroups.value(groupNumber).at(i)->set("groupNumber", 0);
}
}
QObjectList group = selectedUnits();
mUnitGroups.insert(groupNumber, group);
for (int i = 0; i < group.length(); ++i) {
group.at(i)->set("groupNumber", groupNumber);
}
// console.log("Group " + groupNumber + " created.");
mlogger->statusMessage(tr("Group %1 created.").arg(groupNumber));
}
示例14: children
void
CQGroupBox::
updateCollapsed()
{
//area_->setVisible(isCollapsed());
QObjectList childList = children();
for (int i = 0; i < childList.size(); ++i) {
QObject *o = childList.at(i);
if (! o->isWidgetType()) continue;
QWidget *w = static_cast<QWidget *>(o);
w->setVisible(! isCollapsed());
}
QSize size = this->size();
size.setHeight(minimumSizeHint().height());
resize(size);
}
示例15: if
void Q3WidgetStack::raiseWidget(QWidget *w)
{
if (!w || w == invisible || w->parent() != this || w == topWidget)
return;
if (id(w) == -1)
addWidget(w);
if (!isVisible()) {
topWidget = w;
return;
}
if (w->maximumSize().width() < invisible->width()
|| w->maximumSize().height() < invisible->height())
invisible->setBackgroundMode(backgroundMode());
else if (invisible->backgroundMode() != NoBackground)
invisible->setBackgroundMode(NoBackground);
if (invisible->isHidden()) {
invisible->setGeometry(contentsRect());
invisible->lower();
invisible->show();
QApplication::sendPostedEvents(invisible, QEvent::ShowWindowRequest);
}
// try to move focus onto the incoming widget if focus
// was somewhere on the outgoing widget.
if (topWidget) {
QWidget * fw = window()->focusWidget();
if (topWidget->isAncestorOf(fw)) { // focus was on old page
// look for the best focus widget we can find
QWidget *p = w->focusWidget();
if (!p) {
// second best == first child widget in the focus chain
QWidget *i = fw;
while ((i = i->nextInFocusChain()) != fw) {
if (((i->focusPolicy() & Qt::TabFocus) == Qt::TabFocus)
&& !i->focusProxy() && i->isVisibleTo(w) && i->isEnabled()
&& w->isAncestorOf(i)) {
p = i;
break;
}
}
}
if (p)
p->setFocus();
} else {
// the focus wasn't on the old page, so we have to ensure focus doesn't go to
// the widget in the page that last had focus when we show the page again.
QWidget *oldfw = topWidget->focusWidget();
if (oldfw)
oldfw->clearFocus();
}
}
if (isVisible()) {
emit aboutToShow(w);
int i = id(w);
if (i != -1)
emit aboutToShow(i);
}
topWidget = w;
QObjectList c = children();
for (int i = 0; i < c.size(); ++i) {
QObject * o = c.at(i);
if (o->isWidgetType() && o != w && o != invisible)
static_cast<QWidget *>(o)->hide();
}
w->setGeometry(invisible->geometry());
w->show();
}