Skip to content

Drag resizable layout? #343

Answered by ogoffart
UditDey asked this question in Q&A
Jul 21, 2021 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

Hi,
We don't have a widget to do that, but that's possible to implement "manually"

Here is a quick & dirty way to do it:

HorizontalSplit := Rectangle {
    property<float> proportion: 50%;
    property<float> actual_proportion: touch.pressed ? touch.new_proportion : proportion;

    // This area covers the whole rectangle, but there it can only be clicked form the handle because
    // there is a TouchArea in sub rectangles
    touch := TouchArea {
        property <float> new_proportion: max(0.05, min(0.95, proportion + (mouse_x - pressed_x) / root.width));
        clicked => {
            proportion = new_proportion;
        }
    }

    r1 := Rectangle {
        height: 100%;
        w…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@UditDey
Comment options

@UditDey
Comment options

@ogoffart
Comment options

@UditDey
Comment options

Answer selected by UditDey
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants