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


C++ QChildEvent类代码示例

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


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

示例1: switch

bool QToolBoxHelper::eventFilter(QObject *watched, QEvent *event)
{
    switch (event->type()) {
    case QEvent::ChildPolished:
        // Install on the buttons
        if (watched == m_toolbox) {
            QChildEvent *ce = static_cast<QChildEvent *>(event);
            if (!qstrcmp(ce->child()->metaObject()->className(), "QToolBoxButton"))
                ce->child()->installEventFilter(this);
        }
        break;
    case QEvent::ContextMenu:
        if (watched != m_toolbox) {
            // An action invoked from the passive interactor (ToolBox button) might
            // cause its deletion within its event handler, triggering a warning. Re-post
            // the event to the toolbox.
            QContextMenuEvent *current = static_cast<QContextMenuEvent *>(event);
            QContextMenuEvent *copy = new QContextMenuEvent(current->reason(), current->pos(), current-> globalPos(), current->modifiers());
            QApplication::postEvent(m_toolbox, copy);
            current->accept();
            return true;
        }
        break;
    case QEvent::MouseButtonRelease:
        if (watched != m_toolbox)
            if (QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(m_toolbox)) {
                fw->clearSelection();
                fw->selectWidget(m_toolbox, true);
            }
        break;
    default:
        break;
    }
    return QObject::eventFilter(watched, event);
}
开发者ID:PNIDigitalMedia,项目名称:emscripten-qt,代码行数:35,代码来源:qdesigner_toolbox.cpp

示例2: eventFilter

bool ChildActionEventFilter::eventFilter (QObject *obj, QEvent *event)
{
	if (event->type () == QEvent::ChildAdded ||
			event->type () == QEvent::ChildPolished)
	{
		QChildEvent *e = static_cast<QChildEvent*> (event);
		auto child = e->child ();
		child->installEventFilter (this);

		if (auto act = qobject_cast<QAction*> (child))
			IconThemeEngine::Instance ().UpdateIconset ({ act });
		else if (auto tb = qobject_cast<QToolButton*> (child))
		{
			if (auto act = tb->defaultAction ())
				IconThemeEngine::Instance ().UpdateIconset ({ act });
			if (auto menu = tb->menu ())
				IconThemeEngine::Instance ().UpdateIconset ({ menu->menuAction () });
		}
		else if (auto pb = qobject_cast<QPushButton*> (child))
			IconThemeEngine::Instance ().UpdateIconset ({ pb });
		else
		{
			IconThemeEngine::Instance ()
				.UpdateIconset (child->findChildren<QAction*> ());
			IconThemeEngine::Instance ()
				.UpdateIconset (child->findChildren<QPushButton*> ());
			IconThemeEngine::Instance ()
				.UpdateIconset (child->findChildren<QTabWidget*> ());
		}
		return false;
	}
	else
		return QObject::eventFilter (obj, event);
}
开发者ID:zhao07,项目名称:leechcraft,代码行数:34,代码来源:childactioneventfilter.cpp

示例3: eventFilter

bool EventLoop::eventFilter(QObject *obj, QEvent *event) {
    if ((event->type() == QEvent::KeyPress) ||
        (event->type() == QEvent::KeyRelease) ||
        (event->type() == QEvent::MouseButtonDblClick) ||
        (event->type() == QEvent::MouseButtonPress) ||
        (event->type() == QEvent::MouseButtonRelease) ||
        (event->type() == QEvent::MouseMove)) {
        if (!obj->inherits("QLineEdit") &&
            !obj->inherits("QPushButton") &&
            !obj->inherits("QScrollBar") &&
            !obj->inherits("QScrollArea")) return true;
    }

    if ((event->type() == QEvent::Show) && obj->inherits("QDialog")) {
        if (QApplication::overrideCursor() != NULL) QApplication::changeOverrideCursor(Qt::ArrowCursor);
    }

    if ((event->type() == QEvent::Hide) && obj->inherits("QDialog")) {
        if (QApplication::overrideCursor() != NULL) QApplication::changeOverrideCursor(Qt::WaitCursor);
    }

    if (event->type() == QEvent::ChildAdded) {
        QChildEvent* ce = static_cast<QChildEvent*>(event);
        ce->child()->installEventFilter(this);
    }

    if (event->type() == QEvent::ChildRemoved) {
        QChildEvent* ce = static_cast<QChildEvent*>(event);
        ce->child()->removeEventFilter(this);
    }

    return QEventLoop::eventFilter(obj, event);
}
开发者ID:AlexLevkovich,项目名称:SimpleArch,代码行数:33,代码来源:eventloop.cpp

示例4: foreach

bool ReportBand::eventFilter( QObject *obj, QEvent *evt ) {
    //Draw Line of the TContainerLine
    if (obj == ui->conWidget) {        
        if (evt->type() == QEvent::Paint) {
            QList<TContainerLine *> allContList = this->contWidget->findChildren<TContainerLine *>();
            foreach(TContainerLine *cont, allContList) {
                if (!cont->line.p1().isNull()) {
                    QPainter painter(ui->conWidget);
                    painter.setRenderHint(QPainter::Antialiasing,true);
                    if (cont->line.p2().isNull()) {  //Drawing line, the end is Not set
                        painter.drawLine(cont->line.p1(), mousePos);
                    } else {  //Drawing all lines
                        if (cont->cs != 0 && cont->ce != 0 ) {
                            painter.setPen(QPen(cont->getColorValue(BorderColor),
                                                cont->getBorderWidth(),
                                                QtRPT::getPenStyle(cont->getBorderStyleStr()), Qt::RoundCap));
                            painter.drawLine(cont->cs->pos()+QPoint(3,3), cont->ce->pos()+QPoint(3,3));
                            cont->drawArrow(&painter);
                        }
                    }
                }
            }
        }
        if (evt->type() == QEvent::ChildAdded) {
            //after adding a child, Insert new item into the treeItem
            QChildEvent *e = static_cast< QChildEvent * >( evt );
            newFieldTreeItem(e->child());
        }
    }
开发者ID:gamalielmendez,项目名称:BibliotecaImpresionSql,代码行数:29,代码来源:ReportBand.cpp

示例5: event

bool QcScrollWidget::event ( QEvent * e ) {
    if( e->type() == QEvent::ChildAdded ) {
        QChildEvent *ce = static_cast<QChildEvent*>(e);
        ce->child()->installEventFilter( this );
    }
    return QWidget::event( e );
}
开发者ID:danstowell,项目名称:SuperCute,代码行数:7,代码来源:QcScrollArea.cpp

示例6: Q_D

bool QWindowContainer::event(QEvent *e)
{
    Q_D(QWindowContainer);
    if (!d->window)
        return QWidget::event(e);

    QEvent::Type type = e->type();
    switch (type) {
    case QEvent::ChildRemoved: {
        QChildEvent *ce = static_cast<QChildEvent *>(e);
        if (ce->child() == d->window)
            d->window = 0;
        break;
    }
    // The only thing we are interested in is making sure our sizes stay
    // in sync, so do a catch-all case.
    case QEvent::Resize:
        d->updateGeometry();
        break;
    case QEvent::Move:
        d->updateGeometry();
        break;
    case QEvent::PolishRequest:
        d->updateGeometry();
        break;
    case QEvent::Show:
        d->updateUsesNativeWidgets();
        if (d->isStillAnOrphan()) {
            d->window->setParent(d->usesNativeWidgets
                                 ? windowHandle()
                                 : window()->windowHandle());
        }
        if (d->window->parent()) {
            d->markParentChain();
            d->window->show();
        }
        break;
    case QEvent::Hide:
        if (d->window->parent())
            d->window->hide();
        break;
    case QEvent::FocusIn:
        if (d->window->parent()) {
            if (d->oldFocusWindow != d->window) {
                d->window->requestActivate();
            } else {
                QWidget *next = nextInFocusChain();
                next->setFocus();
            }
        }
        break;
    default:
        break;
    }

    return QWidget::event(e);
}
开发者ID:giucam,项目名称:qtbase,代码行数:57,代码来源:qwindowcontainer.cpp

示例7: eventFilter

bool SMSPlugin::eventFilter(QObject *obj, QEvent *e)
{
    if (e->type() == QEvent::ChildInserted){
        QChildEvent *ce = static_cast<QChildEvent*>(e);
        if (ce->child()->inherits("MainInfo"))
            setPhoneCol(static_cast<MainInfo*>(ce->child()));
    }
    return QObject::eventFilter(obj, e);
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:9,代码来源:sms.cpp

示例8: eventFilter

bool MythWizard::eventFilter( QObject * o, QEvent * e )
{
    if ( o == d->ws && e && e->type() == QEvent::ChildRemoved ) {
        QChildEvent * c = (QChildEvent*)e;
        if ( c->child() && c->child()->isWidgetType() )
            removePage( (QWidget *)c->child() );
    }
    return QWidget::eventFilter( o, e );
}
开发者ID:garybuhrmaster,项目名称:mythtv,代码行数:9,代码来源:mythwizard.cpp

示例9: event

bool QcScrollWidget::event ( QEvent * e ) {
  int t = e->type();
  if( t == QEvent::ChildAdded ) {
    QChildEvent *ce = static_cast<QChildEvent*>(e);
    ce->child()->installEventFilter( this );
  }
  else if( t == QEvent::ChildRemoved ) {
    updateGeometry();
  }

  return QWidget::event( e );
}
开发者ID:DSastre,项目名称:supercollider,代码行数:12,代码来源:QcScrollArea.cpp

示例10: eventFilter

bool SpellPlugin::eventFilter(QObject *o, QEvent *e)
{
    if (e->type() == QEvent::ChildInserted){
        QChildEvent *ce = static_cast<QChildEvent*>(e);
        if (ce->child()->inherits("MsgTextEdit")){
            TextEdit *edit = static_cast<TextEdit*>(ce->child());
            MAP_EDITS::iterator it = m_edits.find(edit);
            if (it == m_edits.end())
                new PSpellHighlighter(edit, this);
        }
    }
    return QObject::eventFilter(o, e);
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:13,代码来源:spell.cpp

示例11: event

/*!
    \reimp
*/
bool QButtonGroup::event( QEvent * e )
{
    if ( e->type() == QEvent::ChildInserted ) {
	QChildEvent * ce = (QChildEvent *) e;
	if ( radio_excl && ::qt_cast<QRadioButton*>(ce->child()) ) {
	    QButton * button = (QButton *) ce->child();
	    if ( button->isToggleButton() && !button->isOn() &&
		 selected() && (selected()->focusPolicy() & TabFocus) != 0 )
		button->setFocusPolicy( (FocusPolicy)(button->focusPolicy() &
					      ~TabFocus) );
	}
    }
    return QGroupBox::event( e );
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:17,代码来源:qbuttongroup.cpp

示例12: switch

bool ChildrenChangeEventFilter::eventFilter(QObject * /*object*/, QEvent *event)
{
    switch (event->type()) {
        case QEvent::ChildAdded:
        case QEvent::ChildRemoved:
            {
                QChildEvent *childEvent = static_cast<QChildEvent*>(event);
                emit childrenChanged(childEvent->child()); break;
            }
        default: break;
    }

    return false;
}
开发者ID:FlavioFalcao,项目名称:qt-creator,代码行数:14,代码来源:childrenchangeeventfilter.cpp

示例13: event

bool QtTreeWidget::event(QEvent* event) {
    QChildEvent* childEvent = nullptr;
    if ((childEvent = dynamic_cast<QChildEvent*>(event))) {
        if (childEvent->polished()) {
            if (dynamic_cast<QLabel*>(childEvent->child())) {
                tooltipShown_ = true;
            }
        }
        else if (childEvent->removed()) {
            if (childEvent->child()->objectName() == "qtooltip_label") {
                tooltipShown_ = false;
            }
        }
    }
    return QAbstractItemView::event(event);
}
开发者ID:swift,项目名称:swift,代码行数:16,代码来源:QtTreeWidget.cpp

示例14: addState

/*!
    \internal
*/
bool QtStateGroup::event(QEvent *event)
{
    if (event->type() == QEvent::ChildAdded) {
        QChildEvent *childEvent = static_cast<QChildEvent *>(event);
        if (QtState *state = qobject_cast<QtState *>(childEvent->child())) {
            if (state->group() != this)
                addState(state);
        }
    } else if (event->type() == QEvent::ChildRemoved) {
        QChildEvent *childEvent = static_cast<QChildEvent *>(event);
        if (QtState *state = qobject_cast<QtState *>(childEvent->child())) {
            if (state->group() == this)
                removeState(state);
        }
    }
    return QObject::event(event);
}
开发者ID:BackupTheBerlios,项目名称:horux-svn,代码行数:20,代码来源:qstategroup.cpp

示例15: eventFilter

bool PopupMenuEditorItem::eventFilter( QObject * o, QEvent * event )
{
    if ( ! ::qt_cast<QActionGroup*>( o ) )
	return FALSE;
    if ( event->type() == QEvent::ChildInserted ) {
	QChildEvent * ce = ( QChildEvent * ) event;
	QObject * c = ce->child();
	QAction * action = ::qt_cast<QAction*>( c );
	if ( s->find( action ) != -1 ) // avoid duplicates
	    return FALSE;
	QActionGroup * actionGroup = ::qt_cast<QActionGroup*>( c );
	if ( actionGroup )
	    s->insert( actionGroup );
 	else if ( action )
 	    s->insert( action );
    }
    return FALSE;
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:18,代码来源:popupmenueditor.cpp


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