本文整理汇总了C++中QChildEvent::child方法的典型用法代码示例。如果您正苦于以下问题:C++ QChildEvent::child方法的具体用法?C++ QChildEvent::child怎么用?C++ QChildEvent::child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QChildEvent
的用法示例。
在下文中一共展示了QChildEvent::child方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: childEvent
void KoVBox::childEvent(QChildEvent *event)
{
switch (event->type()) {
case QEvent::ChildAdded: {
QChildEvent *childEvent = static_cast<QChildEvent *>(event);
if (childEvent->child()->isWidgetType()) {
QWidget *widget = static_cast<QWidget *>(childEvent->child());
static_cast<QBoxLayout *>(layout())->addWidget(widget);
}
break;
}
case QEvent::ChildRemoved: {
QChildEvent *childEvent = static_cast<QChildEvent *>(event);
if (childEvent->child()->isWidgetType()) {
QWidget *widget = static_cast<QWidget *>(childEvent->child());
static_cast<QBoxLayout *>(layout())->removeWidget(widget);
}
break;
}
default:
break;
}
QFrame::childEvent(event);
}
示例2: eventFilter
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);
}
示例3: event
bool TVHBox::event(QEvent* ev)
{
switch (ev->type()) {
case QEvent::ChildAdded:
{
QChildEvent* childEv = static_cast<QChildEvent *>(ev);
if (childEv->child()->isWidgetType()) {
QWidget* w = static_cast<QWidget *>(childEv->child());
static_cast<QBoxLayout *>(layout())->addWidget(w);
}
return QWidget::event(ev);
}
case QEvent::ChildRemoved:
{
QChildEvent* childEv = static_cast<QChildEvent *>(ev);
if (childEv->child()->isWidgetType()) {
QWidget* w = static_cast<QWidget *>(childEv->child());
static_cast<QBoxLayout *>(layout())->removeWidget(w);
}
return QWidget::event(ev);
}
default:
return QWidget::event(ev);
}
}
示例4: 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);
}
示例5: eventFilter
bool ZodiakPlugin::eventFilter(QObject *o, QEvent *e)
{
if (e->type() == QEvent::ChildInserted){
QChildEvent *ce = (QChildEvent*)e;
if (ce->child()->inherits("DatePicker")){
DatePicker *picker = (DatePicker*)(ce->child());
list<Picker>::iterator it;
for (it = m_pickers.begin(); it != m_pickers.end(); ++it){
if ((*it).picker == picker)
break;
}
if (it == m_pickers.end())
createLabel(picker);
}
}
if (e->type() == QEvent::ChildRemoved){
QChildEvent *ce = (QChildEvent*)e;
if (ce->child()->inherits("DatePicker")){
DatePicker *picker = (DatePicker*)(ce->child());
for (list<Picker>::iterator it = m_pickers.begin(); it != m_pickers.end(); ++it){
if ((*it).picker == picker){
m_pickers.erase(it);
break;
}
}
}
}
return QObject::eventFilter(o, e);
}
示例6: 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);
}
示例7: 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 );
}
示例8: 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);
}
示例9: 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 );
}
示例10: 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);
}
示例11: 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);
}
示例12: eventFilter
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());
}
}
示例13: 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 );
}
示例14: event
/*!
\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);
}
示例15: event
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);
}