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); }
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); }
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); } }
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); }
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); }
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); }
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 ); }
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); }
/*! \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 ); }
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); }
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); }
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()); } }
bool QcScrollWidget::event ( QEvent * e ) { if( e->type() == QEvent::ChildAdded ) { QChildEvent *ce = static_cast<QChildEvent*>(e); ce->child()->installEventFilter( this ); } return QWidget::event( e ); }
/*! \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); }
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); }
bool KviOptionsWidget::eventFilter(QObject * watched,QEvent * e) { // this is the tab widget if((watched == m_pTabWidget) && (e->type() == QEvent::ChildRemoved)) { QChildEvent * ev = static_cast<QChildEvent *>(e); if(ev->child()->inherits("KviOptionsWidget")) { KviOptionsWidget * pWidget = static_cast<KviOptionsWidget *>(ev->child()); Q_ASSERT(pWidget); QObject::disconnect(pWidget,SIGNAL(destroyed()),this,SLOT(childOptionsWidgetDestroyed())); m_pSelectorInterfaceList->removeRef(pWidget); return false; // continue processing } } return QFrame::eventFilter(watched,e); }
/*! \reimp */ bool QAnimationGroup::event(QEvent *event) { Q_D(QAnimationGroup); if (event->type() == QEvent::ChildAdded) { QChildEvent *childEvent = static_cast<QChildEvent *>(event); if (QAbstractAnimation *a = qobject_cast<QAbstractAnimation *>(childEvent->child())) { if (a->group() != this) addAnimation(a); } } else if (event->type() == QEvent::ChildRemoved) { QChildEvent *childEvent = static_cast<QChildEvent *>(event); QAbstractAnimation *a = static_cast<QAbstractAnimation *>(childEvent->child()); // You can only rely on the child being a QObject because in the QEvent::ChildRemoved // case it might be called from the destructor. int index = d->animations.indexOf(a); if (index != -1) takeAnimation(index); } return QAbstractAnimation::event(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 ); }
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; }
bool MainWindow::eventFilter(QObject *o, QEvent *e) { if (e->type() == QEvent::ChildRemoved){ QChildEvent *ce = static_cast<QChildEvent*>(e); std::list<QWidget*>::iterator it; for (it = statusWidgets.begin(); it != statusWidgets.end(); ++it){ if (*it == ce->child()){ statusWidgets.erase(it); break; } } if(statusWidgets.size() == 0) { statusBar()->hide(); } } return QMainWindow::eventFilter(o, e); }
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; }
/*! \reimp */ bool Q3ButtonGroup::event(QEvent * e) { if (e->type() == QEvent::ChildInserted) { QChildEvent * ce = (QChildEvent *) e; if (QAbstractButton *button = qobject_cast<QAbstractButton*>(ce->child())) { button->setAutoExclusive(false); if (group.exclusive() || qobject_cast<QRadioButton*>(button)) { button->setAutoExclusive(true); QMap<int, QAbstractButton*>::ConstIterator it = buttonIds.constBegin(); while (it != buttonIds.constEnd()) { if (it.value() == button) return Q3GroupBox::event(e); ++it; } } insert(button, id(button)); } } return Q3GroupBox::event(e); }
bool QMainWindow::event( QEvent * e ) { if ( e->type() == Event_ChildRemoved ) { QChildEvent * c = (QChildEvent *) e; if ( c->child() == 0 || c->child()->testWFlags( WType_TopLevel ) ) { // nothing } else if ( c->child() == d->sb ) { d->sb = 0; triggerLayout(); } else if ( c->child() == d->mb ) { d->mb = 0; triggerLayout(); } else if ( c->child() == d->mc ) { d->mc = 0; triggerLayout(); } else { removeToolBar( (QToolBar *)(c->child()) ); triggerLayout(); } } return QWidget::event( e ); }
bool MainWindow::eventFilter(QObject *o, QEvent *e) { #ifdef WIN32 if (o->inherits("QSizeGrip")){ QSizeGrip *grip = static_cast<QSizeGrip*>(o); QMouseEvent *me; switch (e->type()){ case QEvent::MouseButtonPress: me = static_cast<QMouseEvent*>(e); p = me->globalPos(); s = grip->topLevelWidget()->size(); return true; case QEvent::MouseMove: me = static_cast<QMouseEvent*>(e); if (me->state() != LeftButton) break; QWidget *tlw = grip->topLevelWidget(); QRect rc = tlw->geometry(); if (tlw->testWState(WState_ConfigPending)) break; QPoint np(me->globalPos()); int w = np.x() - p.x() + s.width(); int h = np.y() - p.y() + s.height(); if ( w < 1 ) w = 1; if ( h < 1 ) h = 1; QSize ms(tlw->minimumSizeHint()); ms = ms.expandedTo(minimumSize()); if (w < ms.width()) w = ms.width(); if (h < ms.height()) h = ms.height(); if (!(GetWindowLongA(tlw->winId(), GWL_EXSTYLE) & WS_EX_APPWINDOW)){ int dc = GetSystemMetrics(SM_CYCAPTION); int ds = GetSystemMetrics(SM_CYSMCAPTION); tlw->setGeometry(rc.left(), rc.top() + dc - ds, w, h); }else{ tlw->resize(w, h); } MSG msg; while (PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)); return true; } } if (e->type() == QEvent::ChildInserted){ QChildEvent *ce = static_cast<QChildEvent*>(e); if (ce->child()->inherits("QSizeGrip")) ce->child()->installEventFilter(this); } #endif if (e->type() == QEvent::ChildRemoved){ QChildEvent *ce = static_cast<QChildEvent*>(e); list<QWidget*>::iterator it; for (it = statusWidgets.begin(); it != statusWidgets.end(); ++it){ if (*it == ce->child()){ statusWidgets.erase(it); break; } } if (statusWidgets.size() == 0){ statusBar()->hide(); setGrip(); } } return QMainWindow::eventFilter(o, e); }
bool AutohidingSplitter::eventFilter(QObject *target, QEvent *e) { if (!autoHideEnabled) { return QSplitter::eventFilter(target, e); } switch (e->type()) { case QEvent::ChildAdded: { QChildEvent *ce = (QChildEvent*)e; addChild(ce->child()); break; } case QEvent::ChildRemoved: { QChildEvent *ce = (QChildEvent*)e; removeChild(ce->child()); break; } default: break; } if (!autoHideEnabled) { return QSplitter::eventFilter(target, e); } switch (e->type()) { case QEvent::Enter: widgetHoverStarted(indexOf(qobject_cast<QWidget *>(target))); if(popupsBlockingAutohiding.contains(qobject_cast<QWidget *>(target))) { haltModifications = true; } break; case QEvent::Leave: widgetHoverFinished(indexOf(qobject_cast<QWidget *>(target))); if(popupsBlockingAutohiding.contains(qobject_cast<QWidget *>(target))) { haltModifications = false; } break; case QEvent::MouseButtonPress: if(qobject_cast<AutohidingSplitterHandle *>(target)){ for (QTimer *timer: animationDelayTimer) { timer->stop(); } haltModifications = true; } break; case QEvent::MouseButtonRelease:{ if(qobject_cast<AutohidingSplitterHandle *>(target)){ haltModifications = false; targetSizes.clear(); } break; } case QEvent::FocusIn:{ // QFocusEvent *ce = (QFocusEvent *)e; haltModifications = false; break; } case QEvent::FocusOut:{ // QFocusEvent *ce = (QFocusEvent *)e; haltModifications = true; break; } default: break; } return QSplitter::eventFilter(target, e); }
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; #ifndef QT_NO_DRAGANDDROP case QEvent::Drop: case QEvent::DragMove: case QEvent::DragLeave: QCoreApplication::sendEvent(d->window, e); return e->isAccepted(); case QEvent::DragEnter: // Don't reject drag events for the entire widget when one // item rejects the drag enter QCoreApplication::sendEvent(d->window, e); e->accept(); return true; #endif default: break; } return QWidget::event(e); }
bool QLayout::eventFilter( QObject *o, QEvent *e ) { if ( !enabled ) return FALSE; // nothing we can do, should do or want to do if ( o == this && e->type() == QEvent::ChildRemoved ) { //we cannot implement childEvent() or event() because of //###binary compatibility. QChildEvent *c = (QChildEvent*)e; QLayoutIterator it = iterator(); QLayoutItem *item; while ( (item = it.current() ) ) { if ( item == (QLayout*)c->child() ) { it.takeCurrent(); invalidate(); return FALSE; } ++it; } return FALSE; } if ( !o->isWidgetType() ) return FALSE; switch ( e->type() ) { case QEvent::Resize: if ( activated ) { QResizeEvent *r = (QResizeEvent*)e; int mbh = 0; #ifndef QT_NO_MENUBAR if ( menubar && !menubar->isHidden() && !menubar->isTopLevel() ) mbh = menubar->heightForWidth( r->size().width() ); #endif int b = marginImpl ? 0 : outsideBorder; setGeometry( QRect( b, mbh + b, r->size().width() - 2*b, r->size().height() - mbh - 2*b ) ); } else { activate(); } break; case QEvent::ChildRemoved: { QChildEvent *c = (QChildEvent*)e; if ( c->child()->isWidgetType() ) { QWidget *w = (QWidget*)c->child(); #ifndef QT_NO_MENUBAR if ( w == menubar ) menubar = 0; #endif if ( removeWidget( this, w ) ) { QEvent *lh = new QEvent( QEvent::LayoutHint ); QApplication::postEvent( o, lh ); } } break; } case QEvent::ChildInserted: if ( topLevel && autoNewChild ) { QChildEvent *c = (QChildEvent*)e; if ( c->child()->isWidgetType() ) { QWidget *w = (QWidget*)c->child(); if ( !w->isTopLevel() ) { #ifndef QT_NO_MENUBAR if ( w->inherits( "QMenuBar" ) && ( !w->parent() || !w->parent()->inherits( "QToolBar" ) ) ) menubar = (QMenuBar*)w; else #endif addItem( new QWidgetItem( w ) ); QEvent *lh = new QEvent( QEvent::LayoutHint ); QApplication::postEvent( o, lh ); } } } break; case QEvent::LayoutHint: activate(); break; default: break; } return QObject::eventFilter( o, e ); }
bool FlickCharm::eventFilter(QObject *obj, QEvent *event) { QEvent::Type type = event->type(); // make sure that all child widgets added afterwards also get // the event filter installed if(type == QEvent::ChildAdded) { QChildEvent *childEvent = static_cast<QChildEvent*>(event); QObject *child = childEvent->child(); if(child->isWidgetType()) addFilter(static_cast<QWidget *>(child)); return false; } if(type == QEvent::MouseButtonDblClick) return true; if((type != QEvent::MouseButtonPress) && (type != QEvent::MouseButtonRelease) && (type != QEvent::MouseMove)) return false; QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); if (type == QEvent::MouseMove && mouseEvent->buttons() != Qt::LeftButton) return false; if (mouseEvent->modifiers() != Qt::NoModifier) return false; const QPoint mousePos = mouseEvent->globalPos(); if(mousePos.x() < 0 && mousePos.y() < 0) return false; bool consumed = false; if(m_steady) { if (type == QEvent::MouseButtonPress) { if(m_timer.isActive()) m_timer.stop(); m_speed = QPoint(0,0); m_initialPos = mousePos; } // just ignore press and release events in this state ... if (type == QEvent::MouseMove) { if ((mousePos - m_initialPos).manhattanLength() > 5) { // send fake release event at negative position, so whatever is selected // gets unselected QMouseEvent *fakeEvent = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(-100,-100), QPoint(-100,-100), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier); QApplication::postEvent(obj, fakeEvent); scrollTo(mousePos); m_steady = false; } consumed = true; } } else { if (type == QEvent::MouseMove) { scrollTo(mousePos); consumed = true; } else if (type == QEvent::MouseButtonRelease) { if(m_timeStamp.elapsed() < 100) { // start timer for kinetics ... m_steady = true; m_timer.start(MSEC, this); m_releasePos = mousePos; m_count = 0; } consumed = true; } } m_timeStamp = QTime::currentTime(); m_lastPos = mousePos; return consumed; }