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


C++ GlMainWidget::hasMouseTracking方法代码示例

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


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

示例1: eventFilter

bool PixelOrientedViewNavigator::eventFilter(QObject *widget, QEvent *e) {

    if(e->type() != QEvent::MouseButtonDblClick && e->type() != QEvent::MouseMove)
        return false;

    GlMainWidget *glWidget = (GlMainWidget *) widget;

    if (!glWidget->hasMouseTracking()) {
        glWidget->setMouseTracking(true);
    }

    if (!pixelView->smallMultiplesViewSet() && !pixelView->interactorsEnabled()) {
        pixelView->toggleInteractors(true);
    }

    if (pixelView->getOverviews().size() == 0) {
        return false;
    }

    if (e->type() == QEvent::MouseMove && pixelView->smallMultiplesViewSet()) {
        QMouseEvent *me = (QMouseEvent *) e;
        int x = glWidget->width() - me->x();
        int y = me->y();
        Coord screenCoords(x, y, 0);
        Coord sceneCoords = glWidget->getScene()->getGraphCamera().viewportTo3DWorld(glWidget->screenToViewport(screenCoords));
        PixelOrientedOverview *overviewUnderPointer = getOverviewUnderPointer(sceneCoords);

        if (overviewUnderPointer != NULL && overviewUnderPointer != selectedOverview) {
            selectedOverview = overviewUnderPointer;
        }

        return true;
    }
    else if (e->type() == QEvent::MouseButtonDblClick) {
        if (selectedOverview != NULL && !selectedOverview->overviewGenerated()) {
            pixelView->generatePixelOverview(selectedOverview, glWidget);
            glWidget->draw();
        }
        else if (selectedOverview != NULL && pixelView->smallMultiplesViewSet()) {
            QtGlSceneZoomAndPanAnimator zoomAndPanAnimator(glWidget, selectedOverview->getBoundingBox());
            zoomAndPanAnimator.animateZoomAndPan();
            pixelView->switchFromSmallMultiplesToDetailView(selectedOverview);
            selectedOverview = NULL;
        }
        else if (!pixelView->smallMultiplesViewSet() && pixelView->getOverviews().size() > 1) {
            pixelView->switchFromDetailViewToSmallMultiples();
            QtGlSceneZoomAndPanAnimator zoomAndPanAnimator(glWidget, pixelView->getSmallMultiplesViewBoundingBox());
            zoomAndPanAnimator.animateZoomAndPan();
            pixelView->centerView();
        }

        return true;
    }

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

示例2: viewChanged

void FishEyeInteractorComponent::viewChanged(View *view) {
  if (view == nullptr) {
    return;
  }

  GlMainView *glView = static_cast<GlMainView *>(view);
  GlMainWidget *glWidget = glView->getGlMainWidget();

  if (!glWidget->hasMouseTracking()) {
    glWidget->setMouseTracking(true);
  }

  if (configWidget->getFishEyeRadius() == 0.) {
    configWidget->setFishEyeRadius(glWidget->getScene()->getGraphCamera().getSceneRadius() / 4.);
    configWidget->setFishEyeHeight(4.);
  }
}
开发者ID:tulip5,项目名称:tulip,代码行数:17,代码来源:FishEyeInteractor.cpp


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