We are in a strange cycle when we have a visual parent. In order to
obtain our position, we need to know our size. Our size depends on the
borders visible. The borders visible depend on the size.
When we do not have a visual parent this is not a problem as we do not
have a position where we are supposed to be.
In order to solve this cycle, when we have a visual parent, we typically
assume we have all borders, call popupPosition, move to that position
and then use that new position to figure out the borders, get the new
size (incase any borders have changed) and move again. This double
moving is not good. With that patch, we still do the same but we avoid
moving twice.
We seem to have cases where once the dialog is visible and the visible
event is over, then the width/height updates itself, so we need to
reposition the dialog appropriately.
The functions are often called a number of times before the
component is actually completed. There is no point of this.
Also added a function updateLayoutParameters which update all 4
of these in a more efficient manner. There is a certain amount
of code duplication between those 4 functions and this one, but
that can be fixed in another patch.
- updateTheme should always be called the frameSvgItem's size has been
upated. It uses the geometry of the frameSvgItem. Also updated the
documentation.
- When a dialog has a visualParent, setting the position of the dialog
is slightly compilcated. In order to set the position we have to give
the function popupPosition the size of the dialog so that it can
determine where to place it, however the size of the dialog depends on
the position as some of the borders are drawn depending on the
position. We have a circular problem.
For now we're solving this by tempoarily giving the full size with all
the borders in the case when there is a visual parent.
Remove the timer and call syncToMainItemSize directly whenever it used
to be called. We avoid the extra event loop this way. This probably
breaks somethings, but we can figure that out and add tests for that.
The only place it is now used is when the window x/y position changes.
There is now a dedicated function to handle that.
This brings us one step closer to removing the entire sync timer
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.
QQuickLoader is a focus scope so that it can automatically forward the
focus to it's item. Conditional loader should do the same and forward
the focus to its internal loader.
Setting the focus is a good thing, the problem with forceActiveFocus is
that it will not allow any child to receive the actual focus, instead
the focus is forced on to the root element of the applet which may not
be desired.
When for example trying to improve keyboard focus behavior of KickOff
without this patch I cannot get the initial focus on the list of
favorites since it gets reset after the applet is created.
REVIEW: 119872