本文整理汇总了C++中GlMainWidget::setMouseTracking方法的典型用法代码示例。如果您正苦于以下问题:C++ GlMainWidget::setMouseTracking方法的具体用法?C++ GlMainWidget::setMouseTracking怎么用?C++ GlMainWidget::setMouseTracking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlMainWidget
的用法示例。
在下文中一共展示了GlMainWidget::setMouseTracking方法的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;
}
示例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.);
}
}