aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/imageviewer/imageviewer.cpp
diff options
context:
space:
mode:
authorEike Ziller <[email protected]>2022-10-18 11:54:39 +0200
committerEike Ziller <[email protected]>2022-10-18 13:08:58 +0000
commit101ef19d1e9bec80e5475885bf74552e49eb6080 (patch)
tree47a57ba67e88144a25f47587ff8ad120db03e164 /src/plugins/imageviewer/imageviewer.cpp
parent1478a3653086e44a0a625c0a4b8ab09a7d6eafa9 (diff)
ImageViewer: Show current default settings in tooltip
List the current default settings in the tooltip for the "Set as Default" button. Fixes: QTCREATORBUG-28322 Change-Id: Ic3a21218a60821e328d6db2375a0e5a08616d686 Reviewed-by: Leena Miettinen <[email protected]> Reviewed-by: <[email protected]> Reviewed-by: Alessandro Portale <[email protected]>
Diffstat (limited to 'src/plugins/imageviewer/imageviewer.cpp')
-rw-r--r--src/plugins/imageviewer/imageviewer.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/imageviewer/imageviewer.cpp b/src/plugins/imageviewer/imageviewer.cpp
index be6f620bf31..441d33dc6ba 100644
--- a/src/plugins/imageviewer/imageviewer.cpp
+++ b/src/plugins/imageviewer/imageviewer.cpp
@@ -158,8 +158,19 @@ void ImageViewer::ctor()
updateIconByTheme(d->actionOutline, QLatin1String("emblem-photos"));
auto setAsDefault = new QAction(Tr::tr("Set as Default"), d->toolbar);
- setAsDefault->setToolTip(Tr::tr("Use the current settings for background, outline, and fitting "
- "to screen as the default for new image viewers."));
+ const auto updateSetAsDefaultToolTip = [this, setAsDefault] {
+ const ImageView::Settings settings = d->imageView->settings();
+ const QString on = Tr::tr("on");
+ const QString off = Tr::tr("off");
+ setAsDefault->setToolTip(
+ "<p>"
+ + Tr::tr("Use the current settings for background, outline, and fitting "
+ "to screen as the default for new image viewers. Current default:")
+ + "</p><p><ul><li>" + Tr::tr("Background: %1").arg(settings.showBackground ? on : off)
+ + "</li><li>" + Tr::tr("Outline: %1").arg(settings.showOutline ? on : off) + "</li><li>"
+ + Tr::tr("Fit to Screen: %1").arg(settings.fitToScreen ? on : off) + "</li></ul>");
+ };
+ updateSetAsDefaultToolTip();
d->labelImageSize = new QLabel;
d->labelInfo = new QLabel;
@@ -226,8 +237,9 @@ void ImageViewer::ctor()
this, &ImageViewer::updatePauseAction);
connect(d->imageView, &ImageView::scaleFactorChanged,
this, &ImageViewer::scaleFactorUpdate);
- connect(setAsDefault, &QAction::triggered, d->imageView, [this] {
+ connect(setAsDefault, &QAction::triggered, d->imageView, [this, updateSetAsDefaultToolTip] {
d->imageView->writeSettings(ICore::settings());
+ updateSetAsDefaultToolTip();
});
}