D9227: [Breeze widget style] Override QLineEditIconButton paint event to force Active icon on press

Hugo Pereira Da Costa noreply at phabricator.kde.org
Thu Dec 7 09:43:10 UTC 2017


hpereiradacosta added a comment.


  In https://phabricator.kde.org/D9227#177017, @broulik wrote:
  
  > So that in `polish()` I change the icon for `QLineEditIconButton` to be a `QIcon` which has manually put the `QIcon::Active` pixmaps in `QIcon::Selected` category? However what are the implications of this wrt speed (how often is `polish` called, I don't think I can "mark" the icon as "already tampered with") and when app changes the icon (need to update the thing)?
  
  
  Hi Kai, 
  In principle it is not called very often. Namely once per widget, and possibly once again when things like color scheme, icon theme, etc are changed. So this should be safe. 
  Now looking in more details at the code, the other place where one could implement the trick is in:  QStyle::standardIcon(), which is called by QLineEdit_p, to asign the icon to the clear button
  (    return q->style()->standardIcon(QStyle::SP_LineEditClearButton, &styleOption, q); )
  The method is already overloaded in kStyle, and can be also overloaded in breezestyle. It takes the parent widget as argument, so that this could be used to decide when to implement the trick.
  
  Finally, I really consider this issue as an upstream bug. 
  The comment: "    // Note isDown should really use the active state but in most styles
  
    // this has no proper feedback" 
  
  is simply not true, especially in kde, where active effects are configurable. So I do not know which "styles" they refer too.
  So here Qt is simply breaking its own documentation API, on purpose, and then we, in order to do the right thing, have to implement some workaround in our code to restore things to how they should be. 
  Would it not be better to file a bug and send a patch upstream ?

REPOSITORY
  R31 Breeze

REVISION DETAIL
  https://phabricator.kde.org/D9227

To: broulik, #plasma, #vdg, hpereiradacosta
Cc: ngraham, plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20171207/709a993a/attachment-0001.html>


More information about the Plasma-devel mailing list