From b0082101d32adf2553611b2379f6b46c1e6871d8 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Tue, 19 Nov 2019 12:36:55 +0200 Subject: [PATCH] Reader: don't forget comic info visibility The timer used to time out and invoke Viewer::informationSwitch() twice before getting destroyed. This caused the following bug: 1. Press 'I' to Show Info in YACReader. 2. Restart YACReader (exit and run again). Info is visible. 3. Restart YACReader one more time. Info is hidden. Apparently, when informationSwitch() was called a second time soon after the first one, informationLabel didn't hide for some reason, but the wrong value (false) was stored at the SHOW_INFO key in Configuration. --- YACReader/viewer.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/YACReader/viewer.cpp b/YACReader/viewer.cpp index c5e54f35..eeae72e2 100644 --- a/YACReader/viewer.cpp +++ b/YACReader/viewer.cpp @@ -205,12 +205,8 @@ void Viewer::prepareForOpening() verticalScrollBar()->setSliderPosition(verticalScrollBar()->minimum()); - if (Configuration::getConfiguration().getShowInformation() && !information) { - auto timer = new QTimer(); - connect(timer, SIGNAL(timeout()), this, SLOT(informationSwitch())); - connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); - timer->start(); - } + if (Configuration::getConfiguration().getShowInformation() && !information) + QTimer::singleShot(0, this, &Viewer::informationSwitch); informationLabel->setText("..."); }