navigator view ready
This commit is contained in:
parent
820ad4e419
commit
e11ca3bba5
|
@ -25,10 +25,36 @@ void NavigatorView::updateMainViewportRegion()
|
|||
{
|
||||
if (m_mainView != nullptr) {
|
||||
m_viewportRegion = mapFromScene(m_mainView->mapToScene(m_mainView->rect()));
|
||||
qDebug() << m_mainView->rect() << m_mainView->mapToScene(m_mainView->rect()) << m_viewportRegion;
|
||||
}
|
||||
}
|
||||
|
||||
void NavigatorView::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
m_mouseDown = true;
|
||||
|
||||
if (m_mainView) {
|
||||
m_mainView->centerOn(mapToScene(event->pos()));
|
||||
}
|
||||
|
||||
return QGraphicsView::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void NavigatorView::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (m_mouseDown && m_mainView) {
|
||||
m_mainView->centerOn(mapToScene(event->pos()));
|
||||
}
|
||||
|
||||
return QGraphicsView::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void NavigatorView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
m_mouseDown = false;
|
||||
|
||||
return QGraphicsView::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void NavigatorView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
event->ignore();
|
||||
|
|
|
@ -16,9 +16,14 @@ public slots:
|
|||
void updateMainViewportRegion();
|
||||
|
||||
private:
|
||||
void mousePressEvent(QMouseEvent * event) override;
|
||||
void mouseMoveEvent(QMouseEvent * event) override;
|
||||
void mouseReleaseEvent(QMouseEvent * event) override;
|
||||
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
bool m_mouseDown = false;
|
||||
QPolygon m_viewportRegion;
|
||||
QGraphicsView *m_mainView = nullptr;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user