https://bugs.kde.org/show_bug.cgi?id=469834

Antonio Russo <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDSINFO                   |CONFIRMED
         Resolution|WAITINGFORINFO              |---

--- Comment #7 from Antonio Russo <[email protected]> ---
Thanks for the hint, andy! Things seem to be a little bit wonky. The following
works:

var oldgeometry = workspace.activeWindow.frameGeometry;
workspace.activeWindow.frameGeometry =
{"x":oldgeometry["x"],"y":oldgeometry["y"],"width":oldgeometry["width"],"height":oldgeometry["height"]};

(i.e., modify any of these parameters, and you can get the effect you're
looking for).  As far as I can tell, top and bottom don't seem to be
necessary/useful.  However, you might think that you could do

var oldgeometry = workspace.activeWindow.frameGeometry;
oldgeometry["width"] = 400;
workspace.activeWindow.frameGeometry = oldgeometry;

but that does not work! You have to create a whole new geometry:

var oldgeometry = workspace.activeWindow.frameGeometry;
var newgeometry =
{"x":oldgeometry["x"],"y":oldgeometry["y"],"width":oldgeometry["width"],"height":oldgeometry["height"]};
newgeometry["width"] = 400;
workspace.activeWindow.frameGeometry = oldgeometry;

I'm guessing the structure that actually comes out of
workspace.activeWindow.frameGeometry is more complicated than a dictionary,
then?

I suggest that this is a documentation bug.  I have not read all of the
(improved, since 2023!) documentation, but I don't immediately see a statement
anywhere explaining any of these quirks.  Moreover, I don't see a description
of how a QRect is represented in the scripting API.  (This was part of my
original question, and I still don't quite understand it).  Of course, one
could dig into the code to figure out how that mapping is done, but it would be
nice if the documentation had this information.

Feel free to close this bug, but I do think that the tutorial should include a
subset/restatement of this bug report in it, at a minimum.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to