Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Baffled by Designer - can't add a Splitter



  • Here's my Widget design.

    6b4eca09-ed08-40f2-9baa-2b53004620cf-image.png

    All I want is to add a horizontal splitter bar just above the wide label with the gradient half way down.

    I can't set the layout for the widget to Layout Vertically with a Splitter as that's greyed out

    What's the trick please.


  • Moderators

    @Perdrix said in Baffled by Designer - can't add a Splitter:

    All I want is to add a horizontal splitter bar just above the wide label with the gradient half way down.

    Behind the scenes, a vertical QSplitter is like a QVBoxLayout -- it is a "container" which lets you insert widgets and layouts. The main difference is that the QSplitter automatically places horizontal splitter bars between neighbouring items but a QVBoxLayout does not.

    Here's the trick:

    1. Select your top-level widget and click "Break Layout".
    2. Drag 2 "Vertical Layouts" onto your widget. They will be free-floating at this point.
    3. Take all the items above your wide label with the gradient and put them into the 1st Vertical Layout.
    4. Take all the items below your wide label with the gradient (including the label itself) and put them into the 2nd Vertical Layout.
    5. Select both Vertical Layouts (for example, by pressing Ctrl+A) and click "Lay Out Vertically in Splitter"
    6. Select your top-level widget and click "Lay Out Vertically"

  • Moderators

    @Perdrix said in Baffled by Designer - can't add a Splitter:

    All I want is to add a horizontal splitter bar just above the wide label with the gradient half way down.

    Behind the scenes, a vertical QSplitter is like a QVBoxLayout -- it is a "container" which lets you insert widgets and layouts. The main difference is that the QSplitter automatically places horizontal splitter bars between neighbouring items but a QVBoxLayout does not.

    Here's the trick:

    1. Select your top-level widget and click "Break Layout".
    2. Drag 2 "Vertical Layouts" onto your widget. They will be free-floating at this point.
    3. Take all the items above your wide label with the gradient and put them into the 1st Vertical Layout.
    4. Take all the items below your wide label with the gradient (including the label itself) and put them into the 2nd Vertical Layout.
    5. Select both Vertical Layouts (for example, by pressing Ctrl+A) and click "Lay Out Vertically in Splitter"
    6. Select your top-level widget and click "Lay Out Vertically"


  • Well! That wasn't at all obvious - I think that needs some attention in the UI or the docs.

    David


  • Moderators

    @Perdrix said in Baffled by Designer - can't add a Splitter:

    Well! That wasn't at all obvious - I think that needs some attention in the UI or the docs.

    I agree.

    Would you be willing to post a suggestion at https://bugreports.qt.io/ ?





  • And was rejected.


Log in to reply