Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/documentview.cpp
Show First 20 Lines • Show All 211 Lines • ▼ Show 20 Line(s) | 211 | if (mBirdEyeView) { | |||
---|---|---|---|---|---|
212 | delete mBirdEyeView; | 212 | delete mBirdEyeView; | ||
213 | } | 213 | } | ||
214 | mBirdEyeView = new BirdEyeView(q); | 214 | mBirdEyeView = new BirdEyeView(q); | ||
215 | mBirdEyeView->setZValue(1); | 215 | mBirdEyeView->setZValue(1); | ||
216 | } | 216 | } | ||
217 | 217 | | |||
218 | void updateCaption() | 218 | void updateCaption() | ||
219 | { | 219 | { | ||
220 | if (!mCurrent) { | ||||
221 | return; | ||||
222 | } | ||||
220 | QString caption; | 223 | QString caption; | ||
muhlenpfordt: Space missing. Maybe just return if `!mCurrent`? | |||||
221 | 224 | | |||
222 | Document::Ptr doc = mAdapter->document(); | 225 | Document::Ptr doc = mAdapter->document(); | ||
223 | if (!doc) { | 226 | if (!doc) { | ||
224 | emit q->captionUpdateRequested(caption); | 227 | emit q->captionUpdateRequested(caption); | ||
225 | return; | 228 | return; | ||
226 | } | 229 | } | ||
227 | 230 | | |||
228 | caption = doc->url().fileName(); | 231 | caption = doc->url().fileName(); | ||
▲ Show 20 Lines • Show All 445 Lines • ▼ Show 20 Line(s) | 670 | { | |||
674 | } | 677 | } | ||
675 | } | 678 | } | ||
676 | 679 | | |||
677 | void DocumentView::setCurrent(bool value) | 680 | void DocumentView::setCurrent(bool value) | ||
678 | { | 681 | { | ||
679 | d->mCurrent = value; | 682 | d->mCurrent = value; | ||
680 | if (value) { | 683 | if (value) { | ||
681 | d->mAdapter->widget()->setFocus(); | 684 | d->mAdapter->widget()->setFocus(); | ||
685 | d->updateCaption(); | ||||
682 | } | 686 | } | ||
683 | update(); | 687 | update(); | ||
684 | } | 688 | } | ||
rkflx: Are you sure that we need to call this for `value == false`? | |||||
685 | 689 | | |||
686 | bool DocumentView::isCurrent() const | 690 | bool DocumentView::isCurrent() const | ||
687 | { | 691 | { | ||
688 | return d->mCurrent; | 692 | return d->mCurrent; | ||
689 | } | 693 | } | ||
690 | 694 | | |||
691 | QPoint DocumentView::position() const | 695 | QPoint DocumentView::position() const | ||
692 | { | 696 | { | ||
Show All 22 Lines | |||||
715 | } | 719 | } | ||
716 | 720 | | |||
717 | void DocumentView::emitHudTrashClicked() | 721 | void DocumentView::emitHudTrashClicked() | ||
718 | { | 722 | { | ||
719 | hudTrashClicked(this); | 723 | hudTrashClicked(this); | ||
720 | } | 724 | } | ||
721 | 725 | | |||
722 | void DocumentView::emitFocused() | 726 | void DocumentView::emitFocused() | ||
723 | { | 727 | { | ||
Please put the { back where it belongs ;) (But perhaps you won't need to touch this function at all, see other comment…) rkflx: Please put the `{` back where it belongs ;)
(But perhaps you won't need to touch this function… | |||||
724 | focused(this); | 728 | focused(this); | ||
725 | } | 729 | } | ||
726 | 730 | | |||
727 | void DocumentView::setGeometry(const QRectF& rect) | 731 | void DocumentView::setGeometry(const QRectF& rect) | ||
728 | { | 732 | { | ||
729 | QGraphicsWidget::setGeometry(rect); | 733 | QGraphicsWidget::setGeometry(rect); | ||
730 | if (d->mBirdEyeView) { | 734 | if (d->mBirdEyeView) { | ||
731 | d->mBirdEyeView->slotZoomOrSizeChanged(); | 735 | d->mBirdEyeView->slotZoomOrSizeChanged(); | ||
▲ Show 20 Lines • Show All 84 Lines • Show Last 20 Lines |
Space missing. Maybe just return if !mCurrent?