<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/130162/">https://git.reviewboard.kde.org/r/130162/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On 六月 19th, 2017, 2:20 p.m. CST, <b>Harald Sitter</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">There are a bunch of things to note here.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Firstly, please always use the new Qt 5 by-reference connection syntax when adding new connections. The old string syntax <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">SIGNAL()</code> and <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">SLOT()</code> are evaluated at runtime making them a substantial point of failure further down the road. https://wiki.qt.io/New_Signal_Slot_Syntax</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Secondly, with QDialogButtonBox you want to connect the box, not the individual buttons, as seen earlier in the constructor.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Thirdly, your change is introducing excessive code. As Anthony said, closeEvent is called when the underlying QWidget gets closed.
i.e. <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::close);</code> without a new slot or anything would be sufficient to get exactly the same result as what you've done. That's not really the correct fix though...</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Lastly, reading the QDialog documentation tells us why closeEvent is not called properly. The button <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">Close</code> has a reject role in the <a href="http://doc.qt.io/qt-5/qdialogbuttonbox.html#StandardButton-enum" style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">QDialogButtonBox</a> meaning it will emit <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">rejected</code> which we connect to <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;
margin: 0;line-height: inherit;">QDialog::reject</code> which is <a href="http://doc.qt.io/qt-5/qdialog.html#reject" style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-sp
ace: normal;">documented</a> as "Hides the modal dialog and sets the result code to Rejected.". Simply put QDialogs practically do not get closed, they get "hidden".</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The way to fix this properly is to reimplemnt <a href="http://doc.qt.io/qt-5/qdialog.html#done" style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: normal;">QDialog::done</a> instead of the closeEvent. <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">done</code> is internally backing both accepted and rejected so it is always run. Change <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">closeEvent(QCloseEvent*)</code> to <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inh
erit;">done(int)</code> and this should work without any other changes.</p></pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Hi Harald,</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Thanks for your hint!</p>
<blockquote style="text-rendering: inherit;padding: 0 0 0 1em;border-left: 1px solid #bbb;white-space: normal;margin: 0 0 0 0.5em;line-height: inherit;">
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The way to fix this properly is to reimplemnt QDialog::done instead of the closeEvent. done is internally backing both accepted and rejected so it is always run. Change closeEvent(QCloseEvent*) to done(int) and this should work without any other changes.</p>
</blockquote>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I will update the patch.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Regards,
Leslie Zhai</p></pre>
<br />
<p>- Leslie</p>
<br />
<p>On 六月 19th, 2017, 12:18 p.m. CST, Leslie Zhai wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
<div>Review request for KDE Multimedia, Albert Astals Cid and Anthony Fieroni.</div>
<div>By Leslie Zhai.</div>
<p style="color: grey;"><i>Updated 六月 19, 2017, 12:18 p.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=381368">381368</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
k3b
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Dear,</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">As Dr. Chaptian reported "do not show again" from system configuration problems dialog is not remembered, so I simply added <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: inherit;">slotClose</code> to write the entry for K3b's KConfigGroup. but I have no idea why QDialogButtonBox::Close could not emit closeEvent, not need to connect, perhaps old Qt v4.x was able to work?</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Regards,
Leslie Zhai</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>src/k3bsystemproblemdialog.h <span style="color: grey">(b45f2f80c)</span></li>
<li>src/k3bsystemproblemdialog.cpp <span style="color: grey">(9dfc50c1d)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/130162/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>