DeclarativeWidgets icon indicating copy to clipboard operation
DeclarativeWidgets copied to clipboard

Add support for Splitter

Open Znurre opened this issue 6 years ago • 5 comments

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.

Znurre avatar Feb 19 '18 20:02 Znurre

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?

0x6e avatar Mar 26 '18 10:03 0x6e

Absolutely, thanks for the feedback. I will look into this later this week.

Znurre avatar Mar 26 '18 10:03 Znurre

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 :)

Znurre avatar Mar 28 '18 16:03 Znurre

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

krake-kdab avatar Mar 29 '18 11:03 krake-kdab

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.

Znurre avatar Mar 29 '18 15:03 Znurre