mapeditor/tiled

Do you want to work on this issue?

You can request for a bounty in order to promote it!

Scripting documentation: Qt.rect's additional properties, TileMap.resize() #3479

eishiya posted onGitHub

(Whoops, did not mean to mark this one as a bug!) Two documentation things, and maybe a feature request:

  1. The documentation for TileMap.resize() says

    This operation can currently only be applied to maps loaded from a file.

    However, it works just fine on open maps that are unsaved. I suspect this is left over from when maps always had to be saved to a file to be opened as documents in Tiled. I haven't thoroughly tested it so I don't know what wording to offer. Does it work for mapFormat.read()? If not, then perhaps appropriate wording would be "[...] maps open in Tiled as documents." If it does work for maps opened from file but not open as documents, then the wording could be "[...] maps open in Tiled as documents, or loaded from a file."

  2. The documentation for Qt.rect only lists its x, y, width, and height properties, but it actually also has left, right, top, bottom properties. These appear to be read-only - trying to set them does not update them or change the rect's other properties. I think these should at least be documented as read-only, as they're very convenient! Better yet, if possible, they should be made settable, updating the rectangle's other properties as appropriate. QRect already has setter functions for them, e.g. https://doc.qt.io/qt-5/qrect.html#setBottom


This operation can currently only be applied to maps loaded from a file.

Yeah, that statement dates back to when you could either create a new map from scripting or load one as a document. But now that we can load maps from files without opening them, or open a map that wasn't loaded from a file, it needs to be reworded. I think "maps open in Tiled as documents", or maybe simply "maps open in Tiled" would do fine. A bit problematic about saying "as documents" is that it might not be clear what is meant because nowhere else do we refer to this as "document" except in the C++ code. In the UI it's open files, and from scripting API it's "open assets".

Regarding Qt.rect, The Qt docs say:

The rect type also exposes read-only left, right, top and bottom attributes.

I'm not sure why they chose to make those read-only, but I don't think I can make those properties settable. It would of course be good to document them.

posted by bjorn over 2 years ago

"maps open in Tiled" would work fine, I think.

Too bad that the QRect extents are readonly. Still, even as read-only they've been quite helpful, so mentioning that they exist and are automatically updated when you change the x/y/width/height would be great :D

posted by eishiya over 2 years ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests