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


C++ QWheelEvent::modifiers方法代码示例

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


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

示例1: eventFilter

bool QtSystemTrayIcon::eventFilter(QObject* object, QEvent* event) {
    if (QObject::eventFilter(object, event)) return true;

    if (object != tray_) return false;

    if (event->type() == QEvent::Wheel) {
        QWheelEvent* e = static_cast<QWheelEvent*>(event);
        if (e->modifiers() == Qt::ShiftModifier) {
            if (e->delta() > 0) {
                emit SeekForward();
            } else {
                emit SeekBackward();
            }
        } else if (e->modifiers() == Qt::ControlModifier) {
            if (e->delta() < 0) {
                emit NextTrack();
            } else {
                emit PreviousTrack();
            }
        } else {
            emit ChangeVolume(e->delta());
        }
        return true;
    }

    return false;
}
开发者ID:ninapixel,项目名称:Clementine,代码行数:27,代码来源:qtsystemtrayicon.cpp

示例2: eventFilter

	bool ZoomEventFilter::eventFilter (QObject *viewObj, QEvent *someEvent)
	{
		if (someEvent->type () != QEvent::Wheel)
			return false;
		
		QWheelEvent *e = static_cast<QWheelEvent*> (someEvent);
		if (!(e->modifiers () & Qt::ControlModifier))
			return false;

		int degrees = e->delta () / 8;
		int steps = static_cast<qreal> (degrees) / 15;

		QWebView *view = qobject_cast<QWebView*> (viewObj);
		if (e->modifiers () & Qt::ShiftModifier)
		{
			auto multiplier = view->textSizeMultiplier ();
			multiplier += steps * 0.1;
			view->setTextSizeMultiplier (multiplier);
		}
		else
		{
			QWebSettings *settings = view->settings ();
			settings->setFontSize (QWebSettings::DefaultFontSize,
					std::max (6, settings->fontSize (QWebSettings::DefaultFontSize) + steps));
			auto frame = view->page ()->mainFrame ();
			frame->evaluateJavaScript ("setTimeout(ScrollToBottom,0);");
		}

		return true;
	}
开发者ID:AlexWMF,项目名称:leechcraft,代码行数:30,代码来源:zoomeventfilter.cpp

示例3: eventFilter

bool MouseMagnifyingGlassInteractorComponent::eventFilter(QObject *, QEvent *e) {

  bool updateMagnifyingGlass = false;
  Coord screenCoords;

  if (e->type() == QEvent::MouseMove) {
    QMouseEvent *me = static_cast<QMouseEvent *>(e);
    float x = glWidget->width() - me->x();
    float y = me->y();
    screenCoords = Coord(x, y, 0);
    boxCenter = camera->viewportTo3DWorld(glWidget->screenToViewport(screenCoords));

    updateMagnifyingGlass = true;
  }
  else if (e->type() == QEvent::Wheel) {
    QWheelEvent *wheelEvent = (QWheelEvent *) e;
    float x = glWidget->width() - wheelEvent->x();
    float y = wheelEvent->y();
    screenCoords = Coord(x, y, 0);
    boxCenter = camera->viewportTo3DWorld(glWidget->screenToViewport(screenCoords));
    int numDegrees = wheelEvent->delta() / 8;
    int numSteps = numDegrees / 15;

    if (wheelEvent->orientation() == Qt::Vertical && (wheelEvent->modifiers() == Qt::ControlModifier)) {
      updateMagnifyingGlass = true;
      radius += numSteps;

      if (radius < 1) radius = 1;

      delete fbo;
      delete fbo2;
      fbo = NULL;
      fbo2 = NULL;
    }
    else if (wheelEvent->orientation() == Qt::Vertical && (wheelEvent->modifiers() == Qt::ShiftModifier)) {
      updateMagnifyingGlass = true;
      magnifyPower += numSteps;

      if (magnifyPower < 1) magnifyPower = 1;
    }
  }

  static bool canUseFbo = QGLFramebufferObject::hasOpenGLFramebufferObjects();

  if (canUseFbo && updateMagnifyingGlass) {
    generateMagnifyingGlassTexture(screenCoords);
    drawInteractor = true;
    glWidget->redraw();
    return true;
  }

  return false;
}
开发者ID:mneumann,项目名称:tulip,代码行数:53,代码来源:MouseMagnifyingGlass.cpp

示例4: eventFilter

bool FishEyeInteractorComponent::eventFilter(QObject *obj, QEvent *e) {

  GlMainWidget *glWidget = (GlMainWidget*)obj;
  Camera *camera=&glWidget->getScene()->getGraphCamera();

  activateFishEye = false;

  if (e->type() == QEvent::MouseMove ||
      e->type() == QEvent::MouseButtonPress ||
      e->type() == QEvent::MouseButtonRelease) {
    activateFishEye = true;
    QMouseEvent *me = (QMouseEvent *) e;
    float x = glWidget->width() - me->x();
    float y = me->y();
    Coord screenCoords(x, y, 0);
    fisheyeCenter = camera->viewportTo3DWorld(glWidget->screenToViewport(screenCoords));
    glWidget->redraw();
    return true;
  }
  else if (e->type() == QEvent::Wheel) {
    activateFishEye = true;
    QWheelEvent *wheelEvent = (QWheelEvent *) e;
    int numDegrees = wheelEvent->delta() / 8;
    int numSteps = numDegrees / 15;

    if (wheelEvent->orientation() == Qt::Vertical && (wheelEvent->modifiers() == Qt::ControlModifier)) {
      activateFishEye = true;
      configWidget->setFishEyeRadius(configWidget->getFishEyeRadius() + configWidget->getFishEyeRadiusIncrementStep() * numSteps);
      glWidget->redraw();
      return true;
    }
    else if (wheelEvent->orientation() == Qt::Vertical && (wheelEvent->modifiers() == Qt::ShiftModifier)) {
      activateFishEye = true;
      float newHeight = configWidget->getFishEyeHeight() + configWidget->getFishEyeHeightIncrementStep() * numSteps;

      if (newHeight < 0) {
        newHeight = 0;
      }

      configWidget->setFishEyeHeight(newHeight);
      glWidget->redraw();
      return true;
    }

    return false;
  }

  return false;

}
开发者ID:mneumann,项目名称:tulip,代码行数:50,代码来源:FishEyeInteractor.cpp

示例5: eventFilter

bool PaletteDockerDock::eventFilter(QObject* object, QEvent* event)
{
    if (object == m_wdgPaletteDock->paletteView->viewport() && event->type() == QEvent::Wheel) {
        QWheelEvent* qwheel = dynamic_cast<QWheelEvent* >(event);
        if (qwheel->modifiers() & Qt::ControlModifier) {

            int numDegrees = qwheel->delta() / 8;
            int numSteps = numDegrees / 7;
            int curSize = m_wdgPaletteDock->paletteView->horizontalHeader()->sectionSize(0);
            int setSize = numSteps + curSize;

            if ( setSize >= 12 ) {
                m_wdgPaletteDock->paletteView->horizontalHeader()->setDefaultSectionSize(setSize);
                m_wdgPaletteDock->paletteView->verticalHeader()->setDefaultSectionSize(setSize);
                KisConfig cfg;
                cfg.setPaletteDockerPaletteViewSectionSize(setSize);
            }
            return true;
        } else {
            return false;
        }
    } else {
        return QWidget::eventFilter(object, event);
    }
}
开发者ID:HOST-Oman,项目名称:krita,代码行数:25,代码来源:palettedocker_dock.cpp

示例6: event

/*!
    \reimp
*/
bool QScrollBar::event(QEvent *event)
{
    switch(event->type()) {
    case QEvent::HoverEnter:
    case QEvent::HoverLeave:
    case QEvent::HoverMove:
    if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
        d_func()->updateHoverControl(he->pos());
        break;
#ifndef QT_NO_WHEELEVENT
    case QEvent::Wheel: {
        event->ignore();
        // override wheel event without adding virtual function override
        QWheelEvent *ev = static_cast<QWheelEvent *>(event);
        int delta = ev->delta();
        // scrollbar is a special case - in vertical mode it reaches minimum
        // value in the upper position, however QSlider's minimum value is on
        // the bottom. So we need to invert a value, but since the scrollbar is
        // inverted by default, we need to inverse the delta value for the
        // horizontal orientation.
        if (ev->orientation() == Qt::Horizontal)
            delta = -delta;
        Q_D(QScrollBar);
        if (d->scrollByDelta(ev->orientation(), ev->modifiers(), delta))
            event->accept();
        return true;
    }
#endif
    default:
        break;
    }
    return QAbstractSlider::event(event);
}
开发者ID:AlekSi,项目名称:phantomjs,代码行数:36,代码来源:qscrollbar.cpp

示例7: eventFilter

bool imageCompareBase::eventFilter(QObject* watched, QEvent* event) {

  // make sure we setCur on an image click
  if (event->type() == QEvent::FocusIn) {
    if (watched == leftScroll_) {
      setCur(leftImage());
    }
    else {
      setCur(rightImage());
    }
  }
  else if (event->type() == QEvent::KeyPress) {
    QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
    return filterKeyEvent(keyEvent);
  }
  else if (event->type() == QEvent::Wheel) {
    QWheelEvent* wheelEvent = static_cast<QWheelEvent*>(event);
    // shift scroll should give a horizontal scroll
    if (wheelEvent->modifiers() == Qt::ShiftModifier) {
      // must check both the scroll and its viewport
      if (watched == rightScroll_ || watched == rightScroll_->viewport()) {
        rightScroll_->horizontalScrollBar()->event(event);
        return true;
      }
      else if (watched == leftScroll_ || watched == leftScroll_->viewport()) {
        leftScroll_->horizontalScrollBar()->event(event);
        return true;
      }
    }
  }
  return imageSaverWindow::eventFilter(watched, event);
}
开发者ID:kleintom,项目名称:Cstitch,代码行数:32,代码来源:imageCompareBase.cpp

示例8: extractArguments

// Extract event-specific arguments to co::Any array
void EventHub::extractArguments( QEvent* event, co::Any* args, int maxArgs )
{
    QEvent::Type ev = event->type();
    switch( ev )
    {
    case QEvent::MouseButtonDblClick:
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonRelease:
    case QEvent::MouseMove:
    {
        QMouseEvent* mouseEvent = static_cast<QMouseEvent*>( event );

        // extract (x and y), button, modifiers
        const QPoint& pos = mouseEvent->pos();
        args[0].set( pos.x() );
        args[1].set( pos.y() );
        args[2].set( static_cast<co::uint32>( ev == QEvent::MouseMove ?
                                              mouseEvent->buttons() : mouseEvent->button() ) );
        fillKeyboardModifiers( mouseEvent->modifiers(), args[3] );
    }
    break;
    case QEvent::KeyPress:
    case QEvent::KeyRelease:
    {
        QKeyEvent* keyEvent = static_cast<QKeyEvent*>( event );
        fillKeyCodeString( keyEvent->key(), args[0] );
        fillKeyboardModifiers( keyEvent->modifiers(), args[1] );
    }
    break;
    case QEvent::Wheel:
    {
        QWheelEvent* wheelEvent = static_cast<QWheelEvent*>( event );

        // extract position (x and y ), delta, modifiers
        const QPoint& pos = wheelEvent->pos();
        args[0].set( pos.x() );
        args[1].set( pos.x() );
        args[2].set( wheelEvent->delta() );
        fillKeyboardModifiers( wheelEvent->modifiers(), args[3] );
    }
    break;
    case QEvent::Resize:
    {
        QResizeEvent* resizeEvent = static_cast<QResizeEvent*>( event );

        // extract size (width and height) and oldSize (width and height)
        const QSize& size = resizeEvent->size();
        const QSize& oldSize = resizeEvent->oldSize();
        args[0].set( size.width() );
        args[1].set( size.height() );
        args[2].set( oldSize.width() );
        args[3].set( oldSize.height() );
    }
    break;
    default:
        // Close, Show and Hide require no arguments
        return;
    }
}
开发者ID:coral-framework,项目名称:coral-qt,代码行数:60,代码来源:EventHub.cpp

示例9: event

bool WebPage::event(QEvent *ev)
{
    QMouseEvent* mouseEvent = NULL;
    QWheelEvent* wheelEvent = NULL;
    QKeyEvent* keyEvent = NULL;
    
    QByteArray byteArray;
    QBuffer buffer(&byteArray);
    buffer.open(QIODevice::ReadWrite);

    QDataStream out(&buffer);

    out << (int) ev->type();
    
    switch (ev->type()) {
    case QEvent::MouseMove:
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonDblClick:
    case QEvent::MouseButtonRelease:
        if (OPNET::OpNetwork::instance()->isReplay() || OPNET::OpNetwork::instance()->isReplica())
            return false;
        mouseEvent = (static_cast<QMouseEvent*>(ev));
        out << mouseEvent->pos() << mouseEvent->globalPos()
            << (int) mouseEvent->button() << (int) mouseEvent->buttons()
            << (int) mouseEvent->modifiers();
        OPNET::OpNetwork::instance()->sendSysCall(MSG_LOG_USER_INPUT, (int) ev->type(), byteArray);
        break;
    case QEvent::Wheel:
        if (OPNET::OpNetwork::instance()->isReplay() || OPNET::OpNetwork::instance()->isReplica())
            return false;;
        wheelEvent = (static_cast<QWheelEvent*>(ev));
        out << wheelEvent->pos() << wheelEvent->globalPos()
            << wheelEvent->delta() << (int) wheelEvent->buttons()
            << (int) wheelEvent->modifiers() << (int) wheelEvent->orientation();
        OPNET::OpNetwork::instance()->sendSysCall(MSG_LOG_USER_INPUT, (int) ev->type(), byteArray);
        break;
    case QEvent::KeyPress:
    case QEvent::KeyRelease:
        if (OPNET::OpNetwork::instance()->isReplay() || OPNET::OpNetwork::instance()->isReplica())
            return false;
        keyEvent = (static_cast<QKeyEvent*>(ev));
        out << keyEvent->key() << (int) keyEvent->modifiers()
            << keyEvent->text() << keyEvent->isAutoRepeat()
            << (int) keyEvent->count();
        OPNET::OpNetwork::instance()->sendSysCall(MSG_LOG_USER_INPUT, (int) ev->type(), byteArray);
        break;
    default:
        break;
    }

    return QWebPage::event(ev);
}
开发者ID:kingst,项目名称:op2-browser,代码行数:52,代码来源:webpage.cpp

示例10: eventFilter

bool PopupItem::eventFilter( QObject *object, QEvent *e )
{
    MarbleWidget *widget = dynamic_cast<MarbleWidget*> ( object );
    if ( !widget ) {
        return BillboardGraphicsItem::eventFilter( object, e );
    }

    if ( e->type() == QEvent::MouseButtonDblClick
            || e->type() == QEvent::MouseMove
            || e->type() == QEvent::MouseButtonPress
            || e->type() == QEvent::MouseButtonRelease )
    {
        // Mouse events are forwarded to the underlying widget
        QMouseEvent *event = static_cast<QMouseEvent*> ( e );
        QPoint const shiftedPos = transform( event->pos() );
        bool const forcedMouseRelease = m_needMouseRelease && e->type() == QEvent::MouseButtonRelease;
        if ( !shiftedPos.isNull() || forcedMouseRelease ) {
            if ( !m_needMouseRelease && e->type() == QEvent::MouseButtonPress ) {
                m_needMouseRelease = true;
            } else if ( forcedMouseRelease ) {
                m_needMouseRelease = false;
            }
            widget->setCursor( Qt::ArrowCursor );
            // transform to children's coordinates
            QMouseEvent shiftedEvent = QMouseEvent( e->type(), shiftedPos,
                                                    event->globalPos(), event->button(), event->buttons(),
                                                    event->modifiers() );
            if ( QApplication::sendEvent( m_webView, &shiftedEvent ) ) {
                widget->setCursor( m_webView->cursor() );
                emit dirty();
                return true;
            }
        }
    } else if ( e->type() == QEvent::Wheel ) {
        // Wheel events are forwarded to the underlying widget
        QWheelEvent *event = static_cast<QWheelEvent*> ( e );
        QPoint const shiftedPos = transform( event->pos() );
        if ( !shiftedPos.isNull() ) {
            widget->setCursor( Qt::ArrowCursor );
            QWheelEvent shiftedEvent = QWheelEvent( shiftedPos,
                                                    event->globalPos(), event->delta(), event->buttons(),
                                                    event->modifiers() );
            if ( QApplication::sendEvent( m_webView, &shiftedEvent ) ) {
                widget->setCursor( m_webView->cursor() );
                emit dirty();
                return true;
            }
        }
    }

    return BillboardGraphicsItem::eventFilter( object, e );
}
开发者ID:ashish173,项目名称:marble,代码行数:52,代码来源:PopupItem.cpp

示例11: runWheelEvent

 ToolResponse runWheelEvent (const QWheelEvent& e) {
   if (e.orientation () == Qt::Vertical && e.modifiers () == Qt::ShiftModifier) {
     if (e.delta () > 0) {
       this->radiusEdit.setIntValue ( this->radiusEdit.intValue ()
                                    + this->radiusEdit.intSingleStep () );
     }
     else if (e.delta () < 0) {
       this->radiusEdit.setIntValue ( this->radiusEdit.intValue ()
                                    - this->radiusEdit.intSingleStep () );
     }
   }
   return ToolResponse::Redraw;
 }
开发者ID:AMDmi3,项目名称:dilay,代码行数:13,代码来源:sculpt.cpp

示例12: eventFilter

    virtual bool eventFilter( QObject *object, QEvent *event )
    {
        if ( event->type() == QEvent::Wheel )
        {
            QWheelEvent *we = ( QWheelEvent * )event;

            QWheelEvent wheelEvent( QPoint( 5, 5 ), we->delta(),
                we->buttons(), we->modifiers(),
                we->orientation() );

            QApplication::sendEvent( this, &wheelEvent );
            return true;
        }
        return QwtWheel::eventFilter( object, event );
    }
开发者ID:Spinetta,项目名称:qwt,代码行数:15,代码来源:wheelbox.cpp

示例13: viewportEvent

bool PicFlowView::viewportEvent ( QEvent * event )
{
    if ( event->type() == QEvent::ToolTip )
    {
        event->ignore();
        return true;
    }
    else if ( event->type() == QEvent::Wheel )
    {
        QWheelEvent *wEvent = static_cast<QWheelEvent *>(event);
        if( wEvent->modifiers() & Qt::ControlModifier ) {
            event->ignore();
            return true;
        }
    }
    return QAbstractItemView::viewportEvent( event );
}
开发者ID:BloodExecutioner,项目名称:vlc,代码行数:17,代码来源:views.cpp

示例14: eventFilter

bool
ArtistInfoWidget::eventFilter( QObject* obj, QEvent* event )
{
    if ( event->type() == QEvent::Wheel )
    {
        QWheelEvent* we = static_cast<QWheelEvent*>( event );
        QWheelEvent* wheelEvent = new QWheelEvent(
            we->pos(),
            we->globalPos(),
            we->delta(),
            we->buttons(),
            we->modifiers(),
            we->orientation() );

        qApp->postEvent( m_area->viewport(), wheelEvent );
        event->accept();
        return true;
    }
    else
        return QObject::eventFilter( obj, event );
}
开发者ID:freddroCT,项目名称:tomahawk,代码行数:21,代码来源:ArtistViewPage.cpp

示例15: mouseWheelTimerFired

void WebView::mouseWheelTimerFired()
{
   pMouseWheelTimer_->stop();

   if (mouseWheelEvents_.empty())
      return;

   int totalDelta = 0;
   for (int i = 0; i < mouseWheelEvents_.length(); i++)
   {
      totalDelta += mouseWheelEvents_.at(i).delta();
   }
   QWheelEvent event = mouseWheelEvents_.last();
   mouseWheelEvents_.clear();
   QWheelEvent totalEvent(event.pos(),
                          event.globalPos(),
                          totalDelta,
                          event.buttons(),
                          event.modifiers(),
                          event.orientation());
   this->QWebView::wheelEvent(&totalEvent);
}
开发者ID:arich,项目名称:rstudio,代码行数:22,代码来源:DesktopWebView.cpp


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