OwlPenn
OwlPenn

Reputation: 81

Qt Designer - How can I create a horizontal line that behaves the way I want it to?

I'm having trouble doing something really simple with Qt Designer (python).

All I want to do is to have a horizontal line as a seperator between the main window and the status bar. That's it. It needs to extend fully across the screen and resize along with the window.

Here is what happens:

The horizontal line is placed where I want it - as a seperator between the main window and status bar

enter image description here

But when I Preview it, the line position is no longer where I put it.

enter image description here

I'll add a vertical spacer because I need to anyway to make the line expandable and resizable with the window.

enter image description here

But as soon as I apply a vertical layout, the position of the line has changed again. In addition, it doesn't extend to the edges of the screen.

enter image description here

This is a preview of the vertical layout. It's far from what I need it to be.

enter image description here

Text version:

  1. I'll put the horizontal line exactly where I want it.

  2. As soon as I preview the window, the line is no longer where I put it. Now it's higher than the chosen placement.

  3. I'll add a vertical spacer because I need to anyway to make the line expandable and resizable with the window.

  4. But as soon as I apply a vertical layout, the position of the line has changed again. In addition, it doesn't extend to the edges of the screen.

  5. Previewing the vertical layout shows that the incorrect way it looked in design mode is how it also looks in preview.

What am I doing wrong? How do I get something as simple as a line to behave the way that I want?

Upvotes: 1

Views: 3058

Answers (1)

C.Fe.
C.Fe.

Reputation: 325

QT - Place Buttons on Bottom Right

This Question is asking something similar, but with buttons.

  1. You have to apply a layout to your top widget (centralwidget if using a main window) by right-clicking on the main window in the object explorer in the top right and choosing layout
  2. Choose the vertical alignment
  3. Add a vertical spacer above the line
  4. Left click on the centralwidget in the object explorer
  5. Set the margins (atleast left, right and bottom) to 0

That should do the job.

Upvotes: 0

Related Questions