git-svn-id: svn://db.shs.com.ru/libs@511 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-03-04 14:26:26 +00:00
parent 8874a626c1
commit e4dfe7db07
2 changed files with 4 additions and 3 deletions

View File

@@ -76,6 +76,8 @@ void BlockView::_init() {
connect(&nav_anim, SIGNAL(finished()), this, SLOT(_navFinished()));
connect(scene_, SIGNAL(sceneRectChanged(QRectF)), this, SLOT(adjustThumb()));
connect(scene_, SIGNAL(selectionChanged()), this, SLOT(sceneSelectionChanged()));
connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(updateNavRect()));
connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(updateNavRect()));
centerOn(scene_->sceneRect().center());
setCacheMode(CacheBackground);
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
@@ -1853,7 +1855,7 @@ void BlockView::_setNav(QRectF v) {
matrix.scale(scl, scl);
nav_rect = v;
QGraphicsView::setTransform(matrix);
QGraphicsView::centerOn(nav_rect.center());
QGraphicsView::centerOn(v.center());
}

View File

@@ -58,8 +58,6 @@ class BlockView: public QGraphicsView
Q_PROPERTY(double _thumb READ _thumb WRITE _setThumb DESIGNABLE false SCRIPTABLE false)
Q_PROPERTY(QRectF _nav READ _nav WRITE _setNav DESIGNABLE false SCRIPTABLE false)
void updateNavRect();
public:
BlockView(QWidget * parent = 0);
BlockView(QGraphicsScene * scene, QWidget * parent = 0);
@@ -209,6 +207,7 @@ protected slots:
void removedBlock(QObject * o);
void removeJunk();
void sceneSelectionChanged();
void updateNavRect();
void _setThumb(double v);
void _setNav(QRectF v);
void _navFinished();