forked from qt-creator/qt-creator
ImageViewer: Make "Fit to Screen" sticky
Instead of "Fit to Screen" being a single-shot action, make it a property that sticks as long as the image is not resized by the other buttons or the mouse wheel. Meaning that it will resize to the screen when the viewer size changes as long as the property is on. Task-number: QTCREATORBUG-27816 Change-Id: I3b790dd7f94e4b964a734658dac4a637c8105b84 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -117,7 +117,7 @@ void ImageViewer::ctor()
|
||||
d->toolButtonOutline->setCheckable(true);
|
||||
d->toolButtonOutline->setChecked(true);
|
||||
|
||||
d->toolButtonFitToScreen->setCheckable(false);
|
||||
d->toolButtonFitToScreen->setCheckable(true);
|
||||
|
||||
d->toolButtonZoomIn->setAutoRepeat(true);
|
||||
|
||||
@@ -199,10 +199,18 @@ void ImageViewer::ctor()
|
||||
d->imageView, &ImageView::zoomIn);
|
||||
connect(d->toolButtonZoomOut, &QAbstractButton::clicked,
|
||||
d->imageView, &ImageView::zoomOut);
|
||||
connect(d->toolButtonFitToScreen, &QAbstractButton::clicked,
|
||||
d->imageView, &ImageView::fitToScreen);
|
||||
connect(d->toolButtonOriginalSize, &QAbstractButton::clicked,
|
||||
d->imageView, &ImageView::resetToOriginalSize);
|
||||
connect(d->toolButtonFitToScreen,
|
||||
&QAbstractButton::toggled,
|
||||
d->imageView,
|
||||
&ImageView::setFitToScreen);
|
||||
connect(d->imageView,
|
||||
&ImageView::fitToScreenChanged,
|
||||
d->toolButtonFitToScreen,
|
||||
&QAbstractButton::setChecked);
|
||||
connect(d->toolButtonOriginalSize,
|
||||
&QAbstractButton::clicked,
|
||||
d->imageView,
|
||||
&ImageView::resetToOriginalSize);
|
||||
connect(d->toolButtonBackground, &QAbstractButton::toggled,
|
||||
d->imageView, &ImageView::setViewBackground);
|
||||
connect(d->toolButtonOutline, &QAbstractButton::toggled,
|
||||
|
||||
Reference in New Issue
Block a user