DeclarativeWidgets
DeclarativeWidgets copied to clipboard
Add support for Splitter
Add support for Splitter. I am not entirely sure about putting stretch as an attached property of Splitter, since it really modifies the SizePolicy of the widget, but it makes for a nice and consistent (with HBoxLayout) API.
In principle I don't see a problem with having a stretch attached property as the original API is only a convenience on changing the size policy (something you couldn't do in DeclarativeWidgets when this patch was created).
This change looks like it would be a good candidate for an addition to the layouts unit test. Whilst not strictly a layout, there are already functions there to compare the geometry of widgets created with imperative Qt Widget and DeclarativeWidgets. Could you add a test case please, comparing layouts created using splitters please?
Absolutely, thanks for the feedback. I will look into this later this week.
Okay, I think I have fixed everything. I decided to drop the attached property in favor of the new sizePolicy property on DeclarativeWidgetExtension, seeing as that works just as well.
Also, please note that there is some inconsistency in the formatting and the dates in the copyright headers.
Some parts of the project use 2 space indent, while others (like the test cases) use 4 space indent. I have tried to match the surrounding formatting, but it would be good to know what is preferred.
Also, some headers simply have "2017" as date, mainly the test parts of the code, while others have "2013-2017". I have tried to match this as well, but as I said, I would really appreciate some hints on what is preferred :)
I decided to drop the attached property in favor of the new sizePolicy property on DeclarativeWidgetExtension, seeing as that works just as well.
Great!
Some parts of the project use 2 space indent, while others (like the test cases) use 4 space indent. I have tried to match the surrounding formatting, but it would be good to know what is preferred.
Yes, the original 2 space indent came from being a "private playground project" from before there was a Qt indentation standard. I would say use 4 spaces for new files like elsewhere in Qt, but keep consistency in old files.
Also, some headers simply have "2017" as date, mainly the test parts of the code, while others have "2013-2017".
I would say just the current year for new files
You're right, I have removed it now. Also thank you for the clarification regarding formatting. I'll make sure to stick to the Qt guidlines for new files in the future.