Review Request 119945: Dialog: Simplify handling of min/max width/height changed

David Edmundson david at davidedmundson.co.uk
Tue Aug 26 18:49:08 UTC 2014



> On Aug. 26, 2014, 6:43 p.m., Marco Martin wrote:
> > src/plasmaquick/dialog.cpp, line 311
> > <https://git.reviewboard.kde.org/r/119945/diff/1/?file=307711#file307711line311>
> >
> >     instead of disconnecting and reconnecting, you can also just block and reenable signals on the object

I don't think you can

Imagine this code:

MainItem
{
   Rectangle {
      anchors.fill:parent
   }
}

as you resize the mainItem ( mainItem.data()->setWidth ) the MainItem will be emitting the width changed signals that the inner rectangle is meant to be reacting to, if you block signals I think the inner item won't change.


- David


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


On Aug. 26, 2014, 5:34 p.m., Vishesh Handa wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/119945/
> -----------------------------------------------------------
> 
> (Updated Aug. 26, 2014, 5:34 p.m.)
> 
> 
> Review request for Plasma.
> 
> 
> Repository: plasma-framework
> 
> 
> Description
> -------
> 
> When the minimumWidth/Height of the attached Layout of the mainItem
> would change. The following events would happen -
> 
> - updateMinimumWidth is called
> --> results in resizeEvent being called
> --> results in syncMainItemToSize
> --> results in slots connected to mainItem widthChanged
> ---> syncMainItemToSize + syncToMainItemSize being called a few more
> times. It's not entirely apparent why at thist point.
> 
> This kind of logic is quite hard to follow and more importantly because
> of the timers in the middle, an extra paint event is called. This means
> the user can first see the window resize and then the item getting
> resized.
> 
> This patch introduces a little bit of code duplication (can be fixed in
> future commits) to clearly establish what updateMinimumWidth should be
> doing -
> * disconnect signals to make sure mainItem's widthChange is not triggered
> * update window size + item size + borders
> * reposition if required
> 
> The repositioning is useful as currently if a dialog becomes wider if
> will not reposition itself and will overflow. With this patch we always
> make sure the entire dialog is shown.
> 
> Minor Point: On testing without the patch the dialog does reposition
> itself if it is not already overflowing. I suspect this is kwin moving
> the window.
> 
> A test called dialog_minWidthHeighRepositioning.qml can be used to see
> how the change occurs before and after.
> 
> 
> Diffs
> -----
> 
>   src/plasmaquick/dialog.h f207f88 
>   src/plasmaquick/dialog.cpp 02271e4 
> 
> Diff: https://git.reviewboard.kde.org/r/119945/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Vishesh Handa
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20140826/bfd28fe5/attachment.html>


More information about the Plasma-devel mailing list