Skip to content
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

ENH: Friendlier segment editor widget for better intergration in layouts #1085

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vovythevov
Copy link

This PR aims to simplify integration of the Segment Editor widget in other widget.
Here is an illustration of what it looks like with and without this PR.
illustration

The code used to generate this is here:
SegmentEditorUIFix.zip

@vovythevov vovythevov requested a review from lassoan January 30, 2019 20:40
@vovythevov
Copy link
Author

Also, here is the SegmentEditor before/after the change:

segmenteditor_illustration

@cpinter
Copy link
Member

cpinter commented Jan 30, 2019

When we tried to do similar fixes in the past, there were always some bugs that came out when stress-testing that prevented applying that specific fix. So please try every option, in every effect, including the "Show details" button in the effect panels. Thanks!

@fedorov
Copy link
Member

fedorov commented Jan 31, 2019

@che85 isn't this the problem you've been fighting with in SDT/SliceTracker?

@che85
Copy link

che85 commented Jan 31, 2019

That's right, but after setting up my new development environment I didn't get to continue working on it.

Definitely looks good to me! Qt can be such a pain when it comes to sizing widgets.

@jamesobutler
Copy link

So I tested this and it does appear to fix the empty space above and below the undo/redo buttons.

However, when selecting an active effect, the options groupbox becomes visible and increases the size of the widget and upon switching back to "None" the widget maintains its size, but the table is the driving force and pushes the effect groupbox down the page farther. @che85 was trying to solve this in #942. This is most noticeable for an effect with a large options groupbox such as "Logical Operators". It is annoying when switching between effects for the effects groupbox to be moving up/down in the SegmentEditorWidget. I would suggest that the table be a fixed size so that the effects groupbox is always in the same position in the widget. This shouldn't be a problem because the table will show a vertical scroll bar once there are more contents than can be shown in the max size.

@vovythevov vovythevov force-pushed the SegmentEditorWidget-MinorUIFix branch from 8b40719 to e812f09 Compare January 31, 2019 14:53
@vovythevov
Copy link
Author

vovythevov commented Jan 31, 2019

Thanks everyone for the feedback ! I agree, layouts are finicky :)

I amended my commit and I think that provides a satisfying user experience. The table widget is now properly resizable (up to a minimum of a 100 pixel. That particular value is arbitrary, feel free to change it

). The effect buttons resizes itself properly when switching to and from each effect without affecting the size of the table.
The only thing is that there is a small jitter when switching from an effect to None. I am not sure where it comes from.

Here is a (low quality) gif to illustrate it all:
segmenteditordemo_lowquality

@jamesobutler
Copy link

The table widget is now properly resizable (up to a minimum of a 100 pixel. That particular value is arbitrary, feel free to change it).

I totally support that change for it to be resizeable instead of my suggested fixed size. The changes to keep the effect groupbox in the same location upon switching effects looks great! Good work!

I'm also not sure why adjusting the bottom widget and then changing to none causes that jitter in the layout policy. I'll see if I can help out. This is pretty close to being complete.

@jamesobutler
Copy link

I have been messing around with this layout stuff for awhile without any success. When going to the "None" effect, the options groupbox and masking groupbox are hidden which results in the segments table in the expandable widget expanding instead of maintaining its currently expanded size and the widget downsizing.

The flickering of the layout also exists in parts when simply collapsing/expanding the masking groupbox. So maybe worth trying to figure out that as a first step.

@lassoan
Copy link
Contributor

lassoan commented Feb 4, 2019

Csaba and I have spent days with trying to improve the layout behavior. There have been many other "almost good" solutions, which were better in several aspects but had some unacceptable issues. I don't think there is a simple fix, just by manipulating existing widget options.

I suspect that some of the CTK widgets that we use don't behave correctly and that throws off Qt's sizing strategy. We may fix the widgets, stop using certain widgets, or reorganize GUI layout to resolve this, but most likely this will require 1-2 weeks of work.

@vovythevov
Copy link
Author

Hi guys,

Thanks for all the interest on this. I agree, with you @lassoan, I think that issues are coming from the CTK widget (particurarly the ctkExpadingWidget) and this is shaping up to be a much bigger change that I anticipated. Sorry for opening pandora's box :(

If anything can be salvaged from this PR though, I think we could at least remove the spacer item from the widget and move it into the python widget (respectively from here and to here).

I will let you decide what do with this PR, please feel free to close it, spin if off into an issue, cherry-pick part of it or whatever you think is appropriate.

@jcfr
Copy link
Member

jcfr commented Feb 5, 2019

I am jumping into the conversation and i am probably missing some points but I was wondering if the ctkDynamicSpacer would be of any help.

/// Description
/// A spacer widget that has a dynamic size policy controllable via its slot
/// activate(bool). It can be usefully when you don't want a rigid layout. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants