Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7866493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:25:01+00:00 2026-06-03T00:25:01+00:00

I had a layout all nicely designed in Qt, but as soon as I

  • 0

I had a layout all nicely designed in Qt, but as soon as I clicked on the parent window and set it to a grid layout, things got all wonky:

enter image description here

As you can see, the vertical layout on the left insists on being wider than the children it contains. Both the label and the treeview are set to sizePolicy Maximum, and the maximum width is set to 260px. The children themselves stay the correct size, but the vertical layout that contains them doesn’t.

The vertical layout in the middle is set to expanding, and the one on the far right is set up the same as the one on the left, only that one appears to work. How do I make the first vertical layout conform to its children’s width?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:25:02+00:00Added an answer on June 3, 2026 at 12:25 am

    The problem is most likely that you need to experiment with “stretching” the layout. Stretch sets the size of layout cells in relation to each other. The default is 0, which means no stretching occurs.

    In your case, I believe you want to set the stretch of the first column (column 0) to 0, and the stretch of the second and third columns to 1. This means that the first column will always be as small as possible, and the second and third columns will try to be equally wide.

    You can set the stretch programmatically quite easily; for example, to set the first column to stretch 0:

    layout->setColumnStretch(0, 0);
    

    In Qt Designer you can access column and row stretches as any normal properties.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had already setup the buttons and the layout properly, but I'm having an
i want to include design in all pages, for this i had set a
OK, I had asked a similar question before and had got an answer but
our svn had so far traditional layout: trunk branches/ tags/ i cloned whole the
I had tried to to put checkbox in listview through layout inflator and I
Had a good search here but can't see anything that gets my mind in
I had my sqlalchemy related code in my main() method in my script. But
I have tried all that i could to generate the R.java file but in
I had a working Spring Roo webapp, but it didn't have any jQuery in
I already posted this issue but had edited it so many times I thought

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.