Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/documentviewsynchronizer.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 48 | { | |||
---|---|---|---|---|---|
49 | if (!mCurrentView || !mActive) { | 49 | if (!mCurrentView || !mActive) { | ||
50 | return; | 50 | return; | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | QObject::connect(mCurrentView.data(), SIGNAL(zoomChanged(qreal)), | 53 | QObject::connect(mCurrentView.data(), SIGNAL(zoomChanged(qreal)), | ||
54 | q, SLOT(setZoom(qreal))); | 54 | q, SLOT(setZoom(qreal))); | ||
55 | QObject::connect(mCurrentView.data(), SIGNAL(zoomToFitChanged(bool)), | 55 | QObject::connect(mCurrentView.data(), SIGNAL(zoomToFitChanged(bool)), | ||
56 | q, SLOT(setZoomToFit(bool))); | 56 | q, SLOT(setZoomToFit(bool))); | ||
57 | QObject::connect(mCurrentView.data(), SIGNAL(zoomToFitWidthChanged(bool)), | 57 | QObject::connect(mCurrentView.data(), SIGNAL(zoomToFillChanged(bool)), | ||
58 | q, SLOT(setZoomToFitWidth(bool))); | 58 | q, SLOT(setZoomToFill(bool))); | ||
59 | QObject::connect(mCurrentView.data(), SIGNAL(positionChanged()), | 59 | QObject::connect(mCurrentView.data(), SIGNAL(positionChanged()), | ||
60 | q, SLOT(updatePosition())); | 60 | q, SLOT(updatePosition())); | ||
61 | 61 | | |||
62 | Q_FOREACH(DocumentView* view, *mViews) { | 62 | Q_FOREACH(DocumentView* view, *mViews) { | ||
63 | if (view == mCurrentView.data()) { | 63 | if (view == mCurrentView.data()) { | ||
64 | continue; | 64 | continue; | ||
65 | } | 65 | } | ||
66 | view->setZoom(mCurrentView.data()->zoom()); | 66 | view->setZoom(mCurrentView.data()->zoom()); | ||
67 | view->setZoomToFit(mCurrentView.data()->zoomToFit()); | 67 | view->setZoomToFit(mCurrentView.data()->zoomToFit()); | ||
68 | view->setZoomToFitWidth(mCurrentView.data()->zoomToFitWidth()); | 68 | view->setZoomToFill(mCurrentView.data()->zoomToFill()); | ||
69 | } | 69 | } | ||
70 | } | 70 | } | ||
71 | 71 | | |||
72 | void updateOldPosition() | 72 | void updateOldPosition() | ||
73 | { | 73 | { | ||
74 | if (!mCurrentView || !mActive) { | 74 | if (!mCurrentView || !mActive) { | ||
75 | return; | 75 | return; | ||
76 | } | 76 | } | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | 124 | Q_FOREACH(DocumentView* view, *d->mViews) { | |||
125 | if (view == d->mCurrentView.data()) { | 125 | if (view == d->mCurrentView.data()) { | ||
126 | continue; | 126 | continue; | ||
127 | } | 127 | } | ||
128 | view->setZoomToFit(fit); | 128 | view->setZoomToFit(fit); | ||
129 | } | 129 | } | ||
130 | d->updateOldPosition(); | 130 | d->updateOldPosition(); | ||
131 | } | 131 | } | ||
132 | 132 | | |||
133 | void DocumentViewSynchronizer::setZoomToFitWidth(bool fit) | 133 | void DocumentViewSynchronizer::setZoomToFill(bool fit) | ||
134 | { | 134 | { | ||
135 | Q_FOREACH(DocumentView* view, *d->mViews) { | 135 | Q_FOREACH(DocumentView* view, *d->mViews) { | ||
136 | if (view == d->mCurrentView.data()) { | 136 | if (view == d->mCurrentView.data()) { | ||
137 | continue; | 137 | continue; | ||
138 | } | 138 | } | ||
139 | view->setZoomToFitWidth(fit); | 139 | view->setZoomToFill(fit); | ||
140 | } | 140 | } | ||
141 | d->updateOldPosition(); | 141 | d->updateOldPosition(); | ||
142 | } | 142 | } | ||
143 | 143 | | |||
144 | void DocumentViewSynchronizer::updatePosition() | 144 | void DocumentViewSynchronizer::updatePosition() | ||
145 | { | 145 | { | ||
146 | QPoint pos = d->mCurrentView.data()->position(); | 146 | QPoint pos = d->mCurrentView.data()->position(); | ||
147 | QPoint delta = pos - d->mOldPosition; | 147 | QPoint delta = pos - d->mOldPosition; | ||
Show All 10 Lines |