[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-mac
Subject:    Re: [KDE/Mac] Review Request 126308: KPushButton: respect SH_DialogButtonBox_ButtonsHaveIcons, also 
From:       "David Faure" <faure () kde ! org>
Date:       2015-12-19 10:23:05
Message-ID: 20151219102305.25463.83955 () mimi ! kde ! org
[Download RAW message or body]

--===============7214365216515955237==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126308/#review89737
-----------------------------------------------------------



src/kdeui/kpushbutton.cpp (line 256)
<https://git.reviewboard.kde.org/r/126308/#comment61479>

    This patch looks wrong because KPushButton can be used outside of "dialog button \
boxes", while the styleHint is supposed to be only about dialog button boxes.  
    QPushButton::sizeHint does this:
        bool showButtonBoxIcons = qobject_cast<QDialogButtonBox*>(parentWidget())
                              && \
style()->styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons);  which is a solution \
for testing the parent widget.  
    I still don't fully understand the issue though, at painting time both \
QPushButton and KPushButton call QStyle's CE_PushButton, so I don't see why these two \
would be working differently.  Is this a workaround for KPushButton which doesn't fix \
QPushButton?


- David Faure


On Dec. 11, 2015, 4:26 p.m., René J.V. Bertin wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/126308/
> -----------------------------------------------------------
> 
> (Updated Dec. 11, 2015, 4:26 p.m.)
> 
> 
> Review request for KDE Software on Mac OS X, KDE Frameworks, Qt KDE, Hugo Pereira \
> Da Costa, and Yichao Yu. 
> 
> Repository: kdelibs4support
> 
> 
> Description
> -------
> 
> KF5 applications have long had a habit of drawing icons on buttons even when this \
> feature was turned off in the user's setting. This was mostly noticeable in \
> applications built on kdelibs4support. 
> It seems that the actual culprit is in Qt's QPushButton implementation \
> (https://bugreports.qt.io/browse/QTBUG-49887), but it is possible to work around it \
> in `KPushButton::paintEvent`, by removing the icon (forcing it to the null icon) in \
> the option instance, before handing off control to the painter. 
> 
> Diffs
> -----
> 
> src/kdeui/kdialogbuttonbox.cpp 0f6649b 
> src/kdeui/kpushbutton.cpp 98534fa 
> 
> Diff: https://git.reviewboard.kde.org/r/126308/diff/
> 
> 
> Testing
> -------
> 
> On Kubuntu 14.04 and OS X 10.9.5 with Qt 5.5.1 and KF5 frameworks 5.16.0 .
> 
> I have not yet verified if there are other classes where this modification would be \
> relevant too. 
> 
> Thanks,
> 
> René J.V. Bertin
> 
> 


--===============7214365216515955237==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit




<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/126308/">https://git.reviewboard.kde.org/r/126308/</a>
  </td>
    </tr>
   </table>
   <br />











<div>



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;">  <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;">  <a \
href="https://git.reviewboard.kde.org/r/126308/diff/6/?file=421676#file421676line256" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/kdeui/kpushbutton.cpp</a>  <span style="font-weight: normal;">

     (Diff revision 6)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">void \
KPushButton::paintEvent(QPaintEvent *)</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2">256</font></th>  <td bgcolor="#fdfebc" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>  <th \
bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">256</font></th>  <td bgcolor="#fdfebc" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">    <span \
class="k">if</span> <span class="p">(</span><span class="o">!</span><span \
class="n">text</span><span class="p">().</span><span class="n">isEmpty</span><span \
class="p">()</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span \
class="n">style</span><span class="p">()</span><span class="o">-&gt;</span><span \
class="n">styleHint</span><span class="p">(</span><span class="n">QStyle</span><span \
class="o">::</span><span class="n">SH_DialogButtonBox_ButtonsHaveIcons</span><span \
class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span \
class="k">this</span><span class="p">))</span> <span class="p">{</span></pre></td>  \
</tr>

 </tbody>

</table>

 <div style="margin-left: 2em;">

  <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;">This \
patch looks wrong because KPushButton can be used outside of "dialog button boxes", \
while the styleHint is supposed to be only about dialog button boxes.</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">QPushButton::sizeHint does this:  bool showButtonBoxIcons = \
                qobject_cast&lt;QDialogButtonBox*&gt;(parentWidget())
                          &amp;&amp; \
style()-&gt;styleHint(QStyle::SH_DialogButtonBox_ButtonsHaveIcons); which is a \
solution for testing the parent widget.</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">I still don't fully \
understand the issue though, at painting time both QPushButton and KPushButton call \
QStyle's CE_PushButton, so I don't see why these two would be working differently. Is \
this a workaround for KPushButton which doesn't fix QPushButton?</p></pre>  </div>
</div>
<br />



<p>- David Faure</p>


<br />
<p>On December 11th, 2015, 4:26 p.m. UTC, René J.V. Bertin 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 Software on Mac OS X, KDE Frameworks, Qt KDE, Hugo \
Pereira Da Costa, and Yichao Yu.</div> <div>By René J.V. Bertin.</div>


<p style="color: grey;"><i>Updated Dec. 11, 2015, 4:26 p.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kdelibs4support
</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;">KF5 applications have long had a habit of drawing \
icons on buttons even when this feature was turned off in the user's setting. This \
was mostly noticeable in applications built on kdelibs4support.</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">It seems that the actual culprit is in Qt's QPushButton implementation \
(https://bugreports.qt.io/browse/QTBUG-49887), but it is possible to work around it \
in <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">KPushButton::paintEvent</code>, by removing \
the icon (forcing it to the null icon) in the option instance, before handing off \
control to the painter.</p></pre>  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </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;">On Kubuntu 14.04 and OS X 10.9.5 with Qt 5.5.1 and KF5 \
frameworks 5.16.0 .</p> <p style="padding: 0;text-rendering: inherit;margin: \
0;line-height: inherit;white-space: inherit;">I have not yet verified if there are \
other classes where this modification would be relevant too.</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/kdeui/kdialogbuttonbox.cpp <span style="color: grey">(0f6649b)</span></li>

 <li>src/kdeui/kpushbutton.cpp <span style="color: grey">(98534fa)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/126308/diff/" style="margin-left: \
3em;">View Diff</a></p>






  </td>
 </tr>
</table>







  </div>
 </body>
</html>


--===============7214365216515955237==--


[Attachment #3 (text/plain)]

_______________________________________________
kde-mac@kde.org
List Information: https://mail.kde.org/mailman/listinfo/kde-mac
KDE/Mac Information: http://community.kde.org/Mac

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic