D6767: simplify setContents by letting Qt do more of the work

Harald Sitter noreply at phabricator.kde.org
Tue Jul 18 11:42:27 UTC 2017


sitter updated this revision to Diff 16865.
sitter retitled this revision from "do not keep constructing new selectionmodels" to "simplify setContents by letting Qt do more of the work".
sitter edited the summary of this revision.
sitter added a comment.


  did some more digging with input from David.
  
  we can do away with the selectionModel management entirely. QAIV manages the
  selectionModel itself via setModel.
  it also connects our input model's `destroyed()` signal to the selection
  models deleteLater, so deleting our model will consistently clean up
  the selection as well.
  
  additionally the mode and behavior setting affect only the view itself and
  are persistent across model changes, so we can move this to the ctor (where
  interstingly behavior was already set)
  
  there's one more change we could do to this:
  right now we manually connect _k_slotSelectionChanged to the selection model,
  we need to do this every time we change model. alternatively we could also
  override the `protected virtual selectionChanged`.
  except IIRC this would be BIC with MSVC so we probably don't want this

REPOSITORY
  R236 KWidgetsAddons

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D6767?vs=16861&id=16865

BRANCH
  master

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

AFFECTED FILES
  src/kcharselect.cpp

To: sitter, cfeck, davidedmundson
Cc: davidedmundson, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170718/7f3f76a5/attachment.html>


More information about the Kde-frameworks-devel mailing list