https://bugs.kde.org/show_bug.cgi?id=528265
Bug ID: 528265
Summary: PrintCreator: custom caption text is not applied to
the current print, only to the next one
Classification: Applications
Product: digikam
Version First 8.2.0
Reported In:
Platform: Mint (Ubuntu based)
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: Plugin-Generic-PrintCreator
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Created attachment 197997
--> https://bugs.kde.org/attachment.cgi?id=197997&action=edit
proposed fix
STEPS TO REPRODUCE
1. Select one or more images and open Tools > Print Creator.
2. On the "Caption Settings" page choose caption type "Custom format".
3. Type a caption in the text field (e.g. "Hello").
4. Click Next and print (or check the preview on the cropping page).
OBSERVED RESULT
The typed caption is not printed and does not appear in the preview; the
old/empty
caption is used. When Print Creator is opened again, the caption typed the
previous
time shows up, so the caption always lags one print behind.
EXPECTED RESULT
The caption typed in the field is applied to the current print.
ANALYSIS
In core/dplugins/generic/tools/printcreator/wizard/advprintcaptionpage.cpp:
connect(d->captionUi->m_FreeCaptionFormat, SIGNAL(editingFinished()),
this, SLOT(slotUpdateCaptions()));
m_FreeCaptionFormat is a Digikam::DTextEdit (a QTextEdit subclass). It has no
editingFinished() signal (that exists only in QLineEdit; DTextEdit only adds
returnPressed() and textEdited()). Because the old string-based SIGNAL() syntax
is
used, this fails silently at runtime ("QObject::connect: No such signal
Digikam::DTextEdit::editingFinished()"), so slotUpdateCaptions() is never
called
when the text changes. The per-photo AdvPrintCaptionInfo::m_captionText
therefore
keeps the old value.
validatePage() still stores the text in settings->captionTxt, and on the next
run
initializePage() restores it and calls slotUpdateCaptions(), which is why the
caption appears on the following print.
Verified: applying the equivalent change to the installed 8.2.0 plugin
(connecting
textChanged() instead of editingFinished()) fixes the issue; the caption now
appears
on the correct print.
Workaround: after typing the caption, change the font size (or font/color)
once;
those widgets are connected correctly and trigger slotUpdateCaptions().
PROPOSED FIX (attached as patch)
- Connect QTextEdit::textChanged instead of the non-existent editingFinished().
(textEdited is not suitable: DTextEdit emits it before the key is processed,
so
text() is one character behind.)
- Call slotUpdateCaptions() in validatePage() so the current settings are
always
applied before leaving the page.
--- a/core/dplugins/generic/tools/printcreator/wizard/advprintcaptionpage.cpp
+++ b/core/dplugins/generic/tools/printcreator/wizard/advprintcaptionpage.cpp
@@ -100,8 +100,8 @@
connect(d->captionUi->m_captionType, SIGNAL(activated(int)),
this, SLOT(slotCaptionChanged(int)));
- connect(d->captionUi->m_FreeCaptionFormat, SIGNAL(editingFinished()),
- this, SLOT(slotUpdateCaptions()));
+ connect(d->captionUi->m_FreeCaptionFormat, &QTextEdit::textChanged,
+ this, &AdvPrintCaptionPage::slotUpdateCaptions);
connect(d->captionUi->m_font_name, SIGNAL(currentFontChanged(QFont)),
this, SLOT(slotUpdateCaptions()));
@@ -161,6 +161,10 @@
d->settings->captionSize = d->captionUi->m_font_size->value();
d->settings->captionTxt = d->captionUi->m_FreeCaptionFormat->text();
+ // Ensure the current caption settings are applied to the photos being
printed.
+
+ slotUpdateCaptions();
+
return true;
}
--
You are receiving this mail because:
You are watching all bug changes.