void ScriptableNode::setNodeList( const QString &name, QObjectList objectList )
{
  QScriptValue objectListArray = m_scriptEngine->newArray( objectList.size() );

  for ( int i = 0; i < objectList.size(); ++i ) {
    objectListArray.setProperty( i, m_scriptEngine->newQObject( objectList.at( i ) ) );
  }
  m_concreteNode.setProperty( name, objectListArray );
}
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());
        }

    }
    game->Randomize();
    for(int i = 0; i < objList.size(); i++)
    {
        if (dynamic_cast<View*>(objList.at(i)) != 0 )
        {
            dynamic_cast<View*>(objList.at(i))->display();
        }

    }
    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 and Exit", 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();
}
Esempio n. 3
0
void LightingsControl::OnButtonClicked(const QString &name)
{
    qDebug() << "LightingsControl::OnButtonClicked" << name;
    if (name == "singleOnButton" || name == "singleOffButton") {
        if (name == "singleOnButton")
            ui->singleOffButton->setChecked(false);
        else if (name == "singleOffButton")
            ui->singleOnButton->setChecked(false);
    } else if (name == "allOnButton" || name == "allOffButton") {
        if (name == "allOnButton")
            ui->allOffButton->setChecked(false);
        else if (name == "singleOffButton")
            ui->allOnButton->setChecked(false);
    } else {
        QObjectList objs = ui->frame->children();
        for (int i = 0; i < objs.size(); i++) {
            if (QString("QPushButton") != objs[i]->metaObject()->className())
                continue;

            if (name == objs[i]->objectName())
                ui->lightLabel->setText(tr("Light #%1").arg(i));
            else
                (qobject_cast<QPushButton *>(objs[i]))->setChecked(false);
        }
    }
}
Esempio n. 4
0
bool Controller::hasModel( const Model * m )
{
	QObjectList chldren = children();
	for( int i = 0; i < chldren.size(); ++i )
	{
		QObject * c = chldren.at(i);
		AutomatableModel * am = qobject_cast<AutomatableModel*>(c);
		if( am != NULL )
		{
			if( am == m )
			{
				return true;
			}

			ControllerConnection * cc = am->controllerConnection();
			if( cc != NULL )
			{
				if( cc->getController()->hasModel( m ) )
				{
					return true;
				}
			}
		}
	}
	
	return false;
}
Esempio n. 5
0
void FileRenamerDlgImpl::createButtons()
{
    QBoxLayout* pLayout (dynamic_cast<QBoxLayout*>(m_pButtonsW->layout()));
    CB_ASSERT (0 != pLayout);
    /*int nPos (pLayout->indexOf(pOldBtn));
    pLayout->insertWidget(nPos, this);*/

    QObjectList l (m_pButtonsW->children());
    //qDebug("cnt: %d", l.size());

    for (int i = 1, n = l.size(); i < n; ++i) // l[0] is m_pButtonsW's layout (note that m_pAlbumTypeL is in m_pBtnPanelW)
    {
        delete l[i];
    }

    for (int i = 0, n = cSize(m_vstrPatterns); i < n; ++i)
    {
        QToolButton* p (new QToolButton(m_pButtonsW));
        p->setText(toNativeSeparators(convStr(m_vstrPatterns[i])));
        p->setCheckable(true);
        m_pButtonGroup->addButton(p, m_nBtnId++);
        //p->setAutoExclusive(true);
        connect(p, SIGNAL(clicked()), this, SLOT(onPatternClicked()));
        pLayout->insertWidget(i, p);
    }
}
Esempio n. 6
0
void
CQGroupBox::
updateEnabled()
{
  bool enabled = isEnabled();

  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);

    if (isCheckable()) {
      if (isChecked()) {
//      if (! w->isEnabled()) {
//        if (! w->testAttribute(Qt::WA_ForceDisabled))
            w->setEnabled(true);
//      }
      }
      else {
//      if (w->isEnabled())
          w->setEnabled(false);
      }
    }
    else {
      w->setEnabled(enabled);
    }
  }
}
Esempio n. 7
0
QT_BEGIN_NAMESPACE

void q_createNativeChildrenAndSetParent(const QWidget *parentWidget)
{
    QObjectList children = parentWidget->children();
    for (int i = 0; i < children.size(); i++) {
        if (children.at(i)->isWidgetType()) {
            const QWidget *childWidget = qobject_cast<const QWidget *>(children.at(i));
            if (childWidget) { // should not be necessary
                if (childWidget->testAttribute(Qt::WA_NativeWindow)) {
                    if (!childWidget->windowHandle())
                        childWidget->winId();
                    if (childWidget->windowHandle()) {
                        QWindow *parentWindow = childWidget->nativeParentWidget()->windowHandle();
                        if (childWidget->isWindow())
                            childWidget->windowHandle()->setTransientParent(parentWindow);
                        else
                            childWidget->windowHandle()->setParent(parentWindow);
                    }
                } else {
                    q_createNativeChildrenAndSetParent(childWidget);
                }
            }
        }
    }

}
Esempio n. 8
0
YVCache::YVCache(int idx, QString translation)
  : s_idx(idx)
  , s_translation(0)
  , s_bookIdx(-1)
  , s_chapIdx(-1)
  , m_nm(new QNetworkAccessManager(this))
  , m_reply(0)
  , m_settings("Nettek", "OneBible")
  { translation = translation.toUpper();
    QObjectList t = YVTranslation::namesSt();
    for (int i = 0; i < t.size(); ++i) {

        TranslationNode* node = dynamic_cast<TranslationNode*>(t[i]);
        Q_ASSERT(node);
        if (node->abbrev() == translation) {
            s_translation = node;
            break;
        }
    }

    if (!s_translation) {
        QTimer::singleShot(0, this, SLOT(emitFail()));
        return;
    }

    QTimer::singleShot(0, this, SLOT(getNextBook()));
}
Esempio n. 9
0
static QwtArray<QwtPicker *> activePickers(QWidget *w)
{
    QwtArray<QwtPicker *> pickers;

#if QT_VERSION >= 0x040000
    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;
        }
    }
#else
    QObjectList *children = (QObjectList *)w->children();
    if ( children ) {
        for ( QObjectListIterator it(*children); it.current(); ++it ) {
            QObject *obj = (QObject *)it.current();
            if ( obj->inherits("QwtPicker") ) {
                QwtPicker *picker = (QwtPicker *)obj;
                if ( picker->isEnabled() ) {
                    pickers.resize(pickers.size() + 1);
                    pickers[int(pickers.size()) - 1] = picker;
                }
            }
        }
    }
#endif

    return pickers;
}
Esempio n. 10
0
//-----------------------------------------------------------------------------
void ctkCollapsibleGroupBox::expand(bool _expand)
{
  if (!_expand)
    {
    this->OldSize = this->size();
    }

  QObjectList childList = this->children();
  for (int i = 0; i < childList.size(); ++i) 
    {
    QObject *o = childList.at(i);
    if (o && o->isWidgetType()) 
      {
      QWidget *w = static_cast<QWidget *>(o);
      if ( w )
        {
        w->setVisible(_expand);
        }
      }
    }
  
  if (_expand)
    {
    this->setMaximumHeight(this->MaxHeight);
    this->resize(this->OldSize);
    }
  else
    {
    this->MaxHeight = this->maximumHeight();
    this->setMaximumHeight(22);
    }
}
void QDeclarativeGraphicsGeoMap::populateMap()
{
    if (!mapData_ || !componentCompleted_)
        return;
    QObjectList kids = children();
    for (int i = 0; i < kids.size(); ++i) {
        // dispatch items appropriately
        QDeclarativeGeoMapObjectView* mapView = qobject_cast<QDeclarativeGeoMapObjectView*>(kids.at(i));
        if (mapView) {
            mapViews_.append(mapView);
            setupMapView(mapView);
            continue;
        }
        QDeclarativeGeoMapObject *mapObject = qobject_cast<QDeclarativeGeoMapObject*>(kids.at(i));
        if (mapObject) {
            mapObjects_.append(mapObject);
            objectMap_.insert(mapObject->mapObject(), mapObject);
            mapData_->addMapObject(mapObject->mapObject());
            mapObject->setMap(this);
            continue;
        }
        QDeclarativeGeoMapMouseArea *mouseArea
        = qobject_cast<QDeclarativeGeoMapMouseArea*>(kids.at(i));
        if (mouseArea) {
            mouseArea->setMap(this);
            mouseAreas_.append(mouseArea);
        }
    }
}
Esempio n. 12
0
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
    }
}
Esempio n. 13
0
void panel::on_view_node_properties(k3d::inode* const Node, k3d::iunknown* const Sender)
{
  QObjectList children = ui.properties->children();
  for(int i = 0; i != children.size(); ++i)
    delete children[i];

  QFormLayout* const layout = new QFormLayout(ui.properties);

	if(k3d::iproperty_collection* const property_collection = dynamic_cast<k3d::iproperty_collection*>(Node))
  {
    const k3d::iproperty_collection::properties_t& properties = property_collection->properties();
    k3d::qtui::property_widget_factory property_widget_factory;

    for(int i = 0; i != properties.size(); ++i)
    {
      k3d::iproperty* const property = properties[i];

      QLabel* const property_label = new QLabel(k3d::convert<QString>(property->property_label()));
      property_label->setToolTip(k3d::convert<QString>(property->property_description()));

      QWidget* const property_widget = property_widget_factory.create(*document, *property);
      property_widget->setToolTip(k3d::convert<QString>(property->property_description()));

      layout->addRow(property_label, property_widget);
    }
  }
}
Esempio n. 14
0
void SkinStyle::createWidgetsContainer(QWidget * widget, const QString & objectName) {
    QWidget * container = new QWidget(widget->parentWidget());
    container->setObjectName(objectName);

    QHBoxLayout * layout = new QHBoxLayout();
    container->setLayout(layout);

    QObjectList objects = widget->children();
    for (int i = 0; i < objects.size(); i++) {
        QObject * object = objects.at(i);

        if (object->isWidgetType()) {
            if (!object->inherits("QToolBarHandle") && !object->inherits("QToolBarExtension")) {
                QWidget * w = qobject_cast < QWidget * > (object);
                addWidgetToLayout(w, layout);
                w->show();
            }
        }

        else if (object->inherits("QAction")) {
            QAction * a = qobject_cast < QAction * > (object);
            QWidget * w = new QWidget(container);
            w->addAction(a);
            addWidgetToLayout(w, layout);
        }

        else if (object->inherits("QLayout")) {
            QLayout * l = qobject_cast < QLayout * > (object);
            layout->addLayout(l);
        }
    }

    container->show();
}
Esempio n. 15
0
// DkControlWidget --------------------------------------------------------------------
DkControlWidget::DkControlWidget(DkViewPort *parent, Qt::WindowFlags flags) : QWidget(parent, flags) {

	mViewport = parent;
	setObjectName("DkControlWidget");
	qDebug() << metaObject()->className();

	// cropping
	mCropWidget = new DkCropWidget(QRectF(), this);

	//// thumbnails, metadata
	//thumbPool = new DkThumbPool(QFileInfo(), this);
	mFilePreview = new DkFilePreview(this, flags);
	mMetaDataInfo = new DkMetaDataHUD(this);
	mZoomWidget = new DkZoomWidget(this);
	mPlayer = new DkPlayer(this);
	addActions(mPlayer->getActions().toList());

	mFolderScroll = new DkFolderScrollBar(this);

	// file info - overview
	mFileInfoLabel = new DkFileInfoLabel(this);
	mRatingLabel = new DkRatingLabelBg(2, this, flags);
	addActions(mRatingLabel->getActions().toList());		// register actions
	mCommentWidget = new DkCommentWidget(this);

	// delayed info
	mDelayedInfo = new DkDelayedMessage(QString(), 0, this); // TODO: make a nice constructor
	mDelayedSpinner = new DkDelayedInfo(0, this);

	// info labels
	int loadSize = qMax(Settings::param().display().iconSize, 64);
	mSpinnerLabel = new DkAnimationLabel(":/nomacs/img/loading.svg", QSize(loadSize, loadSize), this);
	mCenterLabel = new DkLabelBg(this, "");
	mBottomLabel = new DkLabelBg(this, "");
	mBottomLeftLabel = new DkLabelBg(this, "");

	// wheel label
	QPixmap wp = QPixmap(":/nomacs/img/thumbs-move.svg");

	mWheelButton = new QLabel(this);
	mWheelButton->setAttribute(Qt::WA_TransparentForMouseEvents);
	mWheelButton->setPixmap(wp);
	mWheelButton->adjustSize();
	mWheelButton->hide();

	// image histogram
	mHistogram = new DkHistogram(this);
	
	init();
	connectWidgets();

	// add mousetracking to all widgets which allows the mViewport for status updates
	QObjectList widgets = children();
	for (int idx = 0; idx < widgets.size(); idx++) {
		if (QWidget* w = qobject_cast<QWidget*>(widgets.at(idx))) {
			w->setMouseTracking(true);
		}
	}
}
Esempio n. 16
0
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]);
    }
}
Esempio n. 17
0
			IWebBrowser* Core::GetWebBrowser () const
			{
				IPluginsManager *pm = Proxy_->GetPluginsManager ();
				QObjectList browsers = pm->Filter<IWebBrowser*> (pm->GetAllPlugins ());
				return browsers.size () ?
					qobject_cast<IWebBrowser*> (browsers.at (0)) :
					0;
			}
Esempio n. 18
0
void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
    Q_D(QWidget);
    d->aboutToDestroy();
    if (!isWindow() && parentWidget())
        parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));

    d->deactivateWidgetCleanup();
    if (testAttribute(Qt::WA_WState_Created)) {
        setAttribute(Qt::WA_WState_Created, false);
        QObjectList childObjects =  children();
        for (int i = 0; i < childObjects.size(); ++i) {
            QObject *obj = childObjects.at(i);
            if (obj->isWidgetType())
                static_cast<QWidget*>(obj)->destroy(destroySubWindows,
                                                     destroySubWindows);
        }
        releaseMouse();
        if (qt_pressGrab == this)
          qt_pressGrab = 0;

        if (keyboardGrb == this)
            releaseKeyboard();
        if (testAttribute(Qt::WA_ShowModal))                // just be sure we leave modal
            QApplicationPrivate::leaveModal(this);
        else if ((windowType() == Qt::Popup))
            qApp->d_func()->closePopup(this);
#ifndef QT_NO_IM
        if (d->ic) {
            delete d->ic;
            d->ic =0;
        } else {
            // release previous focus information participating with
            // preedit preservation of qic -- while we still have a winId
            QInputContext *qic = QApplicationPrivate::inputContext;
            if (qic)
                qic->widgetDestroyed(this);
        }
#endif //QT_NO_IM

        if ((windowType() == Qt::Desktop)) {
        } else {
            if (parentWidget() && parentWidget()->testAttribute(Qt::WA_WState_Created)) {
                d->hide_sys();
            }
            if (destroyWindow && isWindow()) {
                if (d->extra && d->extra->topextra && d->extra->topextra->backingStore)
                    d->extra->topextra->backingStore->windowSurface->setGeometry(QRect());
                qwsDisplay()->destroyRegion(internalWinId());
            }
        }
        QT_TRY {
            d->setWinId(0);
        } QT_CATCH (const std::bad_alloc &) {
            // swallow - destructors must not throw
        }
    }
}
Esempio n. 19
0
void MainWindow::closeWidgets()
{
	QObjectList childrenList = children();
	for (int i = 0; i < childrenList.size(); ++i)
	{
		if (qobject_cast<QWidget*>(childrenList.at(i)))
			qobject_cast<QWidget*>(childrenList.at(i))->close();
	}
}
Esempio n. 20
0
void MainWindow::forceDockTabFonts()
{
    QObjectList chis = children();
    for(int i = 0; i < chis.size(); ++i) {
        if(chis.at(i)->inherits("QTabBar")) {
            ((QTabBar *)chis.at(i))->setFont(KoDockRegistry::dockFont());
        }
    }
}
Esempio n. 21
0
static void setStyleHelper(QWidget *w, QStyle *s)
{
    const QObjectList children = w->children();
    for (int i = 0; i < children.size(); ++i) {
        QObject *child = children.at(i);
        if (child->isWidgetType())
            setStyleHelper((QWidget *) child, s);
    }
    w->setStyle(s);
}
Esempio n. 22
0
void GuiPanel::setHbEditVisible(int vis){
  QObjectList ol = ui->hitboxEdit->children();
  for (int i=0; i<ol.size(); i++) {
      //QObject &o (ol[i]);
      if (ol[i]->isWidgetType()) {
		QWidget* w = qobject_cast<QWidget*>(ol[i]);
        if (w!=ui->editHbActive) w->setVisible(vis);
      }
  }
}
Esempio n. 23
0
void Tools::printChildren(QObject* parent)
{
	const QObjectList objs = parent->children();
    QObject * obj;
    for(int i = 0 ; i < objs.size() ; i++) {
        obj = objs.at(i);
        kDebug() << k_funcinfo << obj->className() << ": " << obj->name() << endl;
    }

}
Esempio n. 24
0
void MainWindow::forceDockTabFonts()
{
    QObjectList chis = children();
    for(int i = 0; i < chis.size(); ++i) {
        if(chis.at(i)->inherits("QTabBar")) {
            QFont dockWidgetFont  = QFontDatabase::systemFont(QFontDatabase::GeneralFont);
            qreal pointSize = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont).pointSizeF();
            dockWidgetFont.setPointSizeF(pointSize);
            ((QTabBar *)chis.at(i))->setFont(dockWidgetFont);
        }
    }
}
Esempio n. 25
0
std::vector<WorkflowState*> WorkflowState::getChildStates()
{
	QObjectList childrenList = this->children();
	std::vector<WorkflowState*> retval;
	for (int i = 0; i < childrenList.size(); ++i)
	{
		WorkflowState* state = dynamic_cast<WorkflowState*>(childrenList[i]);
		if (state)
			retval.push_back(state);
	}
	return retval;
}
Esempio n. 26
0
void MainWindow::forceDockTabFonts()
{
    QObjectList chis = children();
    for(int i = 0; i < chis.size(); ++i) {
        if(chis.at(i)->inherits("QTabBar")) {
            QFont dockWidgetFont  = KGlobalSettings::generalFont();
            qreal pointSize = KGlobalSettings::smallestReadableFont().pointSizeF();
            dockWidgetFont.setPointSizeF(pointSize);
            ((QTabBar *)chis.at(i))->setFont(dockWidgetFont);
        }
    }
}
/*!
    \internal
    Wraps the Motif dialog by setting the X window for the
    QtMotifDialog to the X window id of the dialog shell.
*/
void QtMotifDialog::realize( Widget w )
{
    // use the winid of the dialog shell, reparent any children we have
    if ( XtWindow( w ) != winId() ) {
	XSync(QtMotif::display(), FALSE);

	XtSetMappedWhenManaged( d->shell, False );

	// save the window title
	QString wtitle = windowTitle();
	if (wtitle.isEmpty()) {
 	    char *t = 0;
 	    XtVaGetValues(w, XtNtitle, &t, NULL);
 	    wtitle = QString::fromLocal8Bit(t);
	}
        setWindowTitle(QString()); // make sure setWindowTitle() works below

        QString icontext = windowIconText();
        if (icontext.isEmpty()) {
 	    char *iconName = 0;
 	    XtVaGetValues(w, XtNiconName, &iconName, NULL);
 	    icontext = QString::fromLocal8Bit(iconName);
        }
        setWindowIconText(QString()); // make sure setWindowTitle() works below

	Window newid = XtWindow(w);
	QObjectList list = children();
	for (int i = 0; i < list.size(); ++i) {
	    QWidget *widget = qobject_cast<QWidget*>(list.at(i));
	    if (!widget || widget->isWindow()) continue;

	    XReparentWindow(widget->x11Info().display(), widget->winId(), newid,
			    widget->x(), widget->y());
	}
	QApplication::syncX();

	create( newid, true, true );

	// restore the window title and icon text
 	if (!wtitle.isEmpty())
 	    setWindowTitle(wtitle);
        if (!icontext.isEmpty())
            setWindowIconText(icontext);

	// if this dialog was created without a QWidget parent, then the transient
	// for will be set to the root window, which is not acceptable.
	// instead, set it to the window id of the shell's parent
	if ( ! parent() && XtParent( d->shell ) )
	    XSetTransientForHint(x11Info().display(), newid, XtWindow(XtParent(d->shell)));
    }
    QtMotif::registerWidget( this );
}
Esempio n. 28
0
void MainWindow::Print()
{
    game->print();

    QObjectList objList = this->children();
    for(auto i = 0; i < objList.size(); i++)
    {
        if (dynamic_cast<View*>(objList.at(i)) != 0)
        {
            dynamic_cast<View*>(objList.at(i))->show();
        }
    }
}
Esempio n. 29
0
QObjectList findObjectRecursively(QObject* parent, bool returnFirst, QObjectList& targetList) {
    const QObjectList& children = parent->children();
    Q_FOREACH(QObject* child, children) {
//        if(satisfies(child)) {
//            targetList.push_back(child);
//            if(returnFirst)
//                return targetList;
//        }
        findObjectRecursively(child, returnFirst, targetList);
        if(returnFirst && targetList.size()>0) {
            return targetList;
        }
    }
Esempio n. 30
0
QT_BEGIN_NAMESPACE

PreviewWidget::PreviewWidget( QWidget *parent, const char *name )
    : PreviewWidgetBase( parent, name )
{
    // install event filter on child widgets
    QObjectList l = queryList("QWidget");
    for (int i = 0; i < l.size(); ++i) {
        QObject * obj = l.at(i);
        obj->installEventFilter(this);
        ((QWidget*)obj)->setFocusPolicy(Qt::NoFocus);
    }
}