-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New properties framework #4045
base: master
Are you sure you want to change the base?
New properties framework #4045
Commits on Oct 24, 2024
-
Started a rewrite of the property editor
The new property editor will be based on a widget hierarchy instead of a QTreeView. This will allow better customization and direct widget interaction. This first step implements various property edit widgets which are instantiated based on the type of QVariant values. * DoubleSpinBox, with precision logic from existing property editor * Custom spin boxes and combo boxes which shrink horizontally * Property names elide when there isn't enough space * QPointF and QColor editor factories * Includes a test with all built-in map properties * Supports headers (not collapsible for now) * Supports separators * EnumEditorFactory, with support for non-consecutive enums * Name and editor widgets are stretched by a fixed 2:3 ratio and ignore their size hint * Includes some start on possible API for setting/getting the value
Configuration menu - View commit details
-
Copy full SHA for 2d2a3f1 - Browse repository at this point
Copy the full SHA 2d2a3f1View commit details -
Introduced a responsive editor for QSize
It adjusts the layout based on its width. Also made a few other visual tweaks.
Configuration menu - View commit details
-
Copy full SHA for 5179a8e - Browse repository at this point
Copy the full SHA 5179a8eView commit details -
First fully functional "Map Orientation" property
Introduced Property class and changed from using editor factories to having the property itself create its widget.
Configuration menu - View commit details
-
Copy full SHA for 1637962 - Browse repository at this point
Copy the full SHA 1637962View commit details -
Implemented "Map Size" and "Tile Size" properties
* Map size is read-only but features a "Resize Map" button that triggers the resize dialog. * Both map size and tile size are implemented based on the new "ValueTypeEditorFactory" which selects an editor based on the value type. This functionality is moved out of the VariantEditor. * Introduced AbstractProperty, ValueProperty and QObjectProperty in an attempt to provide some convenience on top of the Property interface. I'm not entirely convinced it was a good idea to put the "createEditor" function on the Property. It makes it easy to do custom widgets for a property, but annoying to have it use a type-based editor.
Configuration menu - View commit details
-
Copy full SHA for 8113c2b - Browse repository at this point
Copy the full SHA 8113c2bView commit details -
Implemented "Infinite" and "Hex Side Length" properties
* Introduced MapProperties class to make it easier to emit valueChanged for all the map's properties, as well to move their creation out of PropertiesWidget::currentObjectChanged. * Added GetSetProperty that makes it easier to define a property in terms of a given getter and setter function, since it avoids the need for a specific Property subclass. * Finished implementation of the BoolEditorFactory (signals connected). * Moved property edit widgets to their own file.
Configuration menu - View commit details
-
Copy full SHA for e40c924 - Browse repository at this point
Copy the full SHA e40c924View commit details -
Configuration menu - View commit details
-
Copy full SHA for 21259d3 - Browse repository at this point
Copy the full SHA 21259d3View commit details -
Implemented remaining Map properties
* Introduced a few helper functions to reduce code duplication, like MapProperties::push. * Disabled properties when they are irrelevant. * Finished connecting the signals for the remaining editor factories: StringEditorFactory, IntEditorFactory, FloatEditorFactory, PointEditorFactory, PointFEditorFactory, RectFEditorFactory and ColorEditorFactory.
Configuration menu - View commit details
-
Copy full SHA for 0ee9d10 - Browse repository at this point
Copy the full SHA 0ee9d10View commit details -
Implemented custom widget for Class property
This property uses an editable combo box with the valid classes set up for the given object type.
Configuration menu - View commit details
-
Copy full SHA for 5e9cb22 - Browse repository at this point
Copy the full SHA 5e9cb22View commit details -
Made most Tileset properties functional
Still needs special handling for: * Color (requires handling invalid/unset values) * Widget for editing allowed transformations * Widget for showing tileset parameters (and trigger edit dialog) * Specifying 1 as minimum value for column count
Configuration menu - View commit details
-
Copy full SHA for ad0a4dd - Browse repository at this point
Copy the full SHA ad0a4ddView commit details -
Some details remain to be done: * Changes made to layer properties should apply to all selected layers * Opacity should probably be a slider now and have appropriate limits * Step size for opacity and parallax factor is too big
Configuration menu - View commit details
-
Copy full SHA for 754fd17 - Browse repository at this point
Copy the full SHA 754fd17View commit details -
Added Image Layer and Group Layer properties
Added support for editing QUrl values using UrlEditorFactory that creates a FileEdit.
Configuration menu - View commit details
-
Copy full SHA for ba5c31d - Browse repository at this point
Copy the full SHA ba5c31dView commit details -
Added properties for map objects
Also in this change: * Made SpinBox and DoubleSpinBox don't respond to changing from keyboard typing immediately. * Share a single implementation of wrapping label/widget pairs for SizeEdit, SizeFEdit, PointEdit, PointFEdit and RectFEdit. * Added widget factories for QFont, QSizeF and Qt::Alignment. * Allow setting suffix on custom FloatEditorFactory, used for adding degree symbol to rotation values. A few things remain to be done: * Custom widget for editing tile object flipping flags * Try reducing size of font editor with style toggle buttons
Configuration menu - View commit details
-
Copy full SHA for 2f0e76a - Browse repository at this point
Copy the full SHA 2f0e76aView commit details -
Implemented Tile, WangSet and WangColor properties
Now all built-in properties are present, apart from some loose ends. * Added RectEdit / RectEditorFactory (QRect values) * Added Property::toolTip (set on label and editor, but currently not functional on label due to the eliding tool tip logic) * Added change events to fix updating of WangSet and WangColor properties (was already broken with old framework)
Configuration menu - View commit details
-
Copy full SHA for 7a6de73 - Browse repository at this point
Copy the full SHA 7a6de73View commit details -
Refactor that gets rid of most editor factories
Instead there are now typed Property subclasses similar to the generic GetSetProperty.
Configuration menu - View commit details
-
Copy full SHA for d89f757 - Browse repository at this point
Copy the full SHA d89f757View commit details -
Renamed ValueTypeEditorFactory to PropertyFactory
This name is more appropriate for what it actually does. It also no longer derives from EditorFactory. PropertyFactory::createQObjectProperty should be functional again. It now returns an appropriate property, and the QObjectProperty class is gone. This approach is still not used, however.
Configuration menu - View commit details
-
Copy full SHA for ddbf1d6 - Browse repository at this point
Copy the full SHA ddbf1d6View commit details -
Simplifying or over-complicating things
* Removed EditorFactory, EnumEditorFactory, AbstractProperty, ValueProperty and GetSetProperty. * EnumProperty now derives from IntProperty and retrieves the enum meta-data based on its template argument. * Use the typed properties to avoid QVariant when synchronizing between the created editor. For the built-in properties, this definitely simplifies things. But it remains to be seen how custom properties are best handled. Also due to the lack of registering editor factories, QObjectProperty is now broken for enums (but it's unused).
Configuration menu - View commit details
-
Copy full SHA for 3211a46 - Browse repository at this point
Copy the full SHA 3211a46View commit details -
Addressed various property todo items
* Apply various minimum and maximum values * Set custom step size where needed * Set file filters where appropriate * Support constraint on RectProperty
Configuration menu - View commit details
-
Copy full SHA for dc083df - Browse repository at this point
Copy the full SHA dc083dfView commit details -
Use tool buttons for text styling in FontProperty
Makes font property widget take up less vertical space.
Configuration menu - View commit details
-
Copy full SHA for c52c920 - Browse repository at this point
Copy the full SHA c52c920View commit details -
Progress on various property editor features
* Added support for editing top-level custom properties (excluding support for classes and enums for now). * Added support for collapsing the property groups, based on a new GroupProperty which creates nested VariantEditor instances. * Removed QVariant based getter/setter from Property, since it doesn't appear to be useful. * Added Property::DisplayMode, which is used to tell apart group properties and separators from regular properties. * VariantEditor is no longer a scroll area itself, to enable nesting.
Configuration menu - View commit details
-
Copy full SHA for 2cb3d25 - Browse repository at this point
Copy the full SHA 2cb3d25View commit details -
Made a special case for the image layer repeat setting
Also made some other small tweaks.
Configuration menu - View commit details
-
Copy full SHA for 09f16a6 - Browse repository at this point
Copy the full SHA 09f16a6View commit details -
Added support for "no label" properties, used for bool values
Also fixed indentatation of property labels to match the header widget. And fixed the margins on the side for groups of properties without separator (affected Custom Properties). Not entirely sure moving the label of boolean properties is the right thing to do.
Configuration menu - View commit details
-
Copy full SHA for e1416bd - Browse repository at this point
Copy the full SHA e1416bdView commit details -
Used Slider for opacity property, replacing the one in Layers view
Opacity is now implemented as IntProperty that goes from 0 to 100. Now the Properties view needs to be open to change the layer opacity. If that's a problem for some we can consider reintroducing the opacity slider in the Layers view.
Configuration menu - View commit details
-
Copy full SHA for 6bbae7f - Browse repository at this point
Copy the full SHA 6bbae7fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3daeedc - Browse repository at this point
Copy the full SHA 3daeedcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 057edb4 - Browse repository at this point
Copy the full SHA 057edb4View commit details -
Fixed an issue with VariantEditor::clear
Not everything was deleted from the layout because the deletion was lacking support for handling nested layouts. Also removed the only remaining case where a nested layout was used at the top-level.
Configuration menu - View commit details
-
Copy full SHA for 0bc17ed - Browse repository at this point
Copy the full SHA 0bc17edView commit details -
Added suffixes, support for custom enums and other progress
* Added "px" suffixes to various pixel values. * Added support for custom enum properties (top-level only so far, because there is no support for class properties yet). It's amazing how trivial this was with the new approach (though, it does not support enums with values as flags yet). * Enabled editing of tileset image parameters through a button and made some progress towards allowing a GroupProperty to appear like a normal property (currently it can, but then it no longer shows its children).
Configuration menu - View commit details
-
Copy full SHA for 82da15c - Browse repository at this point
Copy the full SHA 82da15cView commit details -
Added support for custom enum types that are used as flags
It creates a checkbox for each flag. They will need to be able to collapse in case there are lots of flags, but this works for now.
Configuration menu - View commit details
-
Copy full SHA for fed14c8 - Browse repository at this point
Copy the full SHA fed14c8View commit details -
Allow expanding the child properties for any GroupProperty
Also when it isn't displayed as a header. Also introduced a "level" member of VariantEditor which is passed on to the PropertyLabel, which is used to indent expanded child properties.
Configuration menu - View commit details
-
Copy full SHA for d40ab86 - Browse repository at this point
Copy the full SHA d40ab86View commit details -
Added support for custom class properties
Including changing of nested values. However, several things remain to be done, including: * When the custom properties are refreshed, all properties (and their widgets) are re-created. There should be a way to update their value instead. * There is no way to see yet whether a property is set, nor can its value be reset.
Configuration menu - View commit details
-
Copy full SHA for ba50ef9 - Browse repository at this point
Copy the full SHA ba50ef9View commit details -
Show inherited class name as placeholder text
For map objects, which can inherit their class from their tile or their template.
Configuration menu - View commit details
-
Copy full SHA for 382e4fe - Browse repository at this point
Copy the full SHA 382e4feView commit details -
Implemented Remove and Reset buttons for custom properties
* Top-level custom properties can now be removed. * Class members can be reset. A "modified" state was added to Property, which is updated as necessary and indicated by using bold font for the name. Further tweaks to the spacing between property widgets and draw line to separate property group headers. A generic VariantMapProperty was split off from the CustomProperties class, since the former can also be a base for editing class members. The ColorButton widget now replaces its icon with "Unset" text when an invalid color is set. When changing the "Class" it now affects all selected objects. Fixed layout flicker when collapsing nested class members.
Configuration menu - View commit details
-
Copy full SHA for 74666e1 - Browse repository at this point
Copy the full SHA 74666e1View commit details -
Added ability to add (override) an inherited property
In the previous property editor, overriding happened automatically as soon as you changed a value. Now that the edit widgets are always visible, I've instead opted to show a disabled widget for inherited properties along with a '+' button for adding (overriding) that property. I think this helps unintensionally setting a value, and the disabled state. Currently the VariantMapProperty does not yet handle a possible change of property type when a removed property has a different type than the inherited property.
Configuration menu - View commit details
-
Copy full SHA for c99a1e7 - Browse repository at this point
Copy the full SHA c99a1e7View commit details -
Optimized updating of the list of custom properties
* Now properties that have the same name and type are re-used, avoiding re-creation of editors for most property changes. This also avoids collapsing of nested properties in those cases. * Properties that change type, are re-created. We can still optimise the case where the current object changes further, because in this case all property widgets are still re-created because the CustomProperties object is re-added to the top-level VariantEditor instance.
Configuration menu - View commit details
-
Copy full SHA for 75e24c3 - Browse repository at this point
Copy the full SHA 75e24c3View commit details -
Optimized PropertyLabel to not need a QLineEdit instance
It was only used for calculating the size hint, which is now done with some code copied and adjusted from QLineEdit::sizeHint.
Configuration menu - View commit details
-
Copy full SHA for 02eda6e - Browse repository at this point
Copy the full SHA 02eda6eView commit details -
Don't display label on checkbox for boolean properties
For now it still does this for some common built-in properties, but no longer for custom properties.
Configuration menu - View commit details
-
Copy full SHA for deb0a09 - Browse repository at this point
Copy the full SHA deb0a09View commit details -
Create child property widgets on-demand as they are expanded
Might be necessary for performance reasons, because the amount of widgets created could quickly get out of hand.
Configuration menu - View commit details
-
Copy full SHA for b301505 - Browse repository at this point
Copy the full SHA b301505View commit details -
Handle changes in the custom property types
Now any properties using custom types are re-created when any change is made to the custom types.
Configuration menu - View commit details
-
Copy full SHA for 82ab2cb - Browse repository at this point
Copy the full SHA 82ab2cbView commit details -
Collect property values from all selected objects
In order to allow them to be easily added, when they are not set on the current object.
Configuration menu - View commit details
-
Copy full SHA for 8cc0374 - Browse repository at this point
Copy the full SHA 8cc0374View commit details -
Made layer properties apply to all selected layers
Same for the more specific object layer and image layer properties.
Configuration menu - View commit details
-
Copy full SHA for 629b53c - Browse repository at this point
Copy the full SHA 629b53cView commit details -
Added a custom widget for the object flipping property
Using two toggle buttons rather than checkboxes, similar to the "Allowed Transformations" tileset property. Also changed the stretch factor of the property labels column to be the same as the property editor column. It looks more balanced overall and helps to keep the labels readable when propeties are nested a few levels.
Configuration menu - View commit details
-
Copy full SHA for 9e0c001 - Browse repository at this point
Copy the full SHA 9e0c001View commit details -
Apply changes to map objects to all selected objects
Also made the changes to layer offset and object flipping more specific, only changing the actually changing axis for all selected layers or objects respectively. The same still needs to be done for changing object position or size.
Configuration menu - View commit details
-
Copy full SHA for ed94a00 - Browse repository at this point
Copy the full SHA ed94a00View commit details -
Show the type of custom properties in their tool tip
Also fixed some issues in left-to-right mode.
Configuration menu - View commit details
-
Copy full SHA for da05ecf - Browse repository at this point
Copy the full SHA da05ecfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 58d7a35 - Browse repository at this point
Copy the full SHA 58d7a35View commit details -
Remember the expanded state of custom class properties
The expanded state is now remembered for each "path", meaning you can select different objects, and when they happen to have the same properties the expanded state applies to all of them. For now the state is lost when Tiled is closed. It might be nice to store the list of expanded property paths in the session.
Configuration menu - View commit details
-
Copy full SHA for bd54309 - Browse repository at this point
Copy the full SHA bd54309View commit details -
Added context menu to custom properties
Currently providing access to the existing Add, Remove and Reset actions as well as "Expand All" and "Collapse All" for custom classes. This also adds the fallback icons to the existing action buttons.
Configuration menu - View commit details
-
Copy full SHA for c982c20 - Browse repository at this point
Copy the full SHA c982c20View commit details -
Configuration menu - View commit details
-
Copy full SHA for 35a7ca1 - Browse repository at this point
Copy the full SHA 35a7ca1View commit details -
Configuration menu - View commit details
-
Copy full SHA for fae849c - Browse repository at this point
Copy the full SHA fae849cView commit details -
Spin boxes and combo boxes ignore wheel events when not focused
Otherwise it is too easy to accidentally trigger them while scrolling through the Properties view.
Configuration menu - View commit details
-
Copy full SHA for 56b4deb - Browse repository at this point
Copy the full SHA 56b4debView commit details
Commits on Oct 25, 2024
-
Fixed changing the compression level property
It was affecting the background color instead, due to a wrong constructor overload getting chosen.
Configuration menu - View commit details
-
Copy full SHA for 6fc6c5d - Browse repository at this point
Copy the full SHA 6fc6c5dView commit details
Commits on Oct 29, 2024
-
Addressed a few usability issues
* Cursor no longer jumps to the end when editing string properties. * Global undo/redo shortcuts are no longer overridden by those local to property edit widgets. * Since global undo/redo is now relied upon, the keyboard tracking is enabled again for spin boxes.
Configuration menu - View commit details
-
Copy full SHA for dd0784a - Browse repository at this point
Copy the full SHA dd0784aView commit details -
Made consecutive edits to map properties merge together
Like already happens for the properties of most other data types. The new properties view made it extra noticeable that each change became its own undo command.
Configuration menu - View commit details
-
Copy full SHA for 2177fac - Browse repository at this point
Copy the full SHA 2177facView commit details -
Configuration menu - View commit details
-
Copy full SHA for 82d7b49 - Browse repository at this point
Copy the full SHA 82d7b49View commit details
Commits on Oct 31, 2024
-
Remember the expanded state for built-in property groups
It remembers the expanded state by their index, because this seems like the most desirable behavior. The built-in property groups are now children of a top-level GroupProperty with a new "ChildrenOnly" display mode. This mode suppresses the display of a collapsible header.
Configuration menu - View commit details
-
Copy full SHA for 2cabfad - Browse repository at this point
Copy the full SHA 2cabfadView commit details
Commits on Nov 5, 2024
-
Fixed initialization of SizeProperty::m_minimum
This was causing the map size display to sometimes display way too large values.
Configuration menu - View commit details
-
Copy full SHA for 13fe21e - Browse repository at this point
Copy the full SHA 13fe21eView commit details
Commits on Nov 6, 2024
-
Fixed flickering when rewrapping widget pairs
Rather than rearranging widgets in a QGridLayout in the resize event, we now use a custom layout, which can propertly implement heightForWidth to ensure a smooth layout update.
Configuration menu - View commit details
-
Copy full SHA for 921bce2 - Browse repository at this point
Copy the full SHA 921bce2View commit details -
Fixed opacity slider to also ignore wheel events when not focused
Since handling wheel events interferes with scrolling through the properties.
Configuration menu - View commit details
-
Copy full SHA for 9711234 - Browse repository at this point
Copy the full SHA 9711234View commit details -
Group object "Position" and "Size" properties as "Geometry"
This is mostly to improve the layout since the W is often wider than the X and Y. The minimum size hint for the DoubleSpinBox was increased a bit so it wraps a bit earlier. This change also makes it so that changing any of these values changes only that particular value for all selected objects.
Configuration menu - View commit details
-
Copy full SHA for 023ba4c - Browse repository at this point
Copy the full SHA 023ba4cView commit details
Commits on Nov 8, 2024
-
Used the new properties widget in the Custom Types Editor
* Moved VariantMapProperty to its own file, because it is now also used by the PropertyTypesEditor. * Introduced VariantEditorView to share a bit of code.
Configuration menu - View commit details
-
Copy full SHA for a7777eb - Browse repository at this point
Copy the full SHA a7777ebView commit details -
Configuration menu - View commit details
-
Copy full SHA for 2b710d4 - Browse repository at this point
Copy the full SHA 2b710d4View commit details -
Used the new properties framework in the Project Properties dialog
A bit of a hacky solution to hiding the "Custom Properties" header in this context, because it is now inside a group box with that title.
Configuration menu - View commit details
-
Copy full SHA for 8bf312e - Browse repository at this point
Copy the full SHA 8bf312eView commit details -
Removed now unused VariantEditorFactory and VariantPropertyManager
These have been replaced by the new property framework.
Configuration menu - View commit details
-
Copy full SHA for 4e1a9cf - Browse repository at this point
Copy the full SHA 4e1a9cfView commit details -
Removed the QtPropertyBrowser solution
The QtPropertyBrowser solution has served us well for over 10 years. Now it has been replaced by a new widget-based solution with a more convenient API.
Configuration menu - View commit details
-
Copy full SHA for 3ef1916 - Browse repository at this point
Copy the full SHA 3ef1916View commit details