void DrawWidget::wheelEvent(QWheelEvent * e) { if (!m_isDrag && !m_isRotate) { m_framework->ScaleToPoint(ScaleToPointEvent(L2D(e->x()), L2D(e->y()), exp(e->delta() / 360.0))); UpdateScaleControl(); } }
void DrawWidget::mouseDoubleClickEvent(QMouseEvent * e) { QGLWidget::mouseDoubleClickEvent(e); KillPressTask(); m_isCleanSingleClick = false; if (e->button() == Qt::LeftButton) { StopDragging(e); m_framework->ScaleToPoint(ScaleToPointEvent(L2D(e->x()), L2D(e->y()), 1.5)); UpdateScaleControl(); } }
void DrawWidget::InitRenderPolicy() { #ifndef USE_DRAPE shared_ptr<qt::gl::RenderContext> primaryRC(new qt::gl::RenderContext(this)); graphics::ResourceManager::Params rmParams; rmParams.m_texFormat = graphics::Data8Bpp; rmParams.m_texRtFormat = graphics::Data4Bpp; rmParams.m_videoMemoryLimit = GetPlatform().VideoMemoryLimit(); RenderPolicy::Params rpParams; QRect const & geometry = QApplication::desktop()->geometry(); rpParams.m_screenWidth = L2D(geometry.width()); rpParams.m_screenHeight = L2D(geometry.height()); if (m_ratio >= 1.5 || QApplication::desktop()->physicalDpiX() >= 180) rpParams.m_density = graphics::EDensityXHDPI; else rpParams.m_density = graphics::EDensityMDPI; rpParams.m_videoTimer = m_videoTimer.get(); rpParams.m_useDefaultFB = true; rpParams.m_rmParams = rmParams; rpParams.m_primaryRC = primaryRC; rpParams.m_skinName = "basic.skn"; try { m_framework->SetRenderPolicy(CreateRenderPolicy(rpParams)); m_framework->InitGuiSubsystem(); } catch (graphics::gl::platform_unsupported const & e) { LOG(LERROR, ("OpenGL platform is unsupported, reason: ", e.what())); /// @todo Show "Please Update Drivers" dialog and close the program. } #endif // USE_DRAPE }
m2::PointD MapWidget::GetDevicePoint(QMouseEvent * e) const { return m2::PointD(L2D(e->x()), L2D(e->y())); }
RotateEvent DrawWidget::GetRotateEvent(QPoint const & pt) const { QPoint const center = rect().center(); return RotateEvent(L2D(center.x()), L2D(center.y()), L2D(pt.x()), L2D(pt.y())); }
DragEvent DrawWidget::GetDragEvent(QMouseEvent * e) const { return DragEvent(L2D(e->x()), L2D(e->y())); }