Questions tagged [qlayout]

The QLayout class, part of the Qt framework, is the base class of geometry managers.

This is an abstract base class inherited by the concrete classes QBoxLayout, QGridLayout, QFormLayout, and QStackedLayout.

Documentation can be found here for Qt 4.8 and here for Qt 5.

239 questions
6
votes
1 answer

Switching between multiple ui forms in Qt

I am developing the user interface for a embedded device. I have created about 30 ui forms. You have first the Welcome form which loads the database and connects automatically to the available known wifi and all those start up functions. Once…
gfernandes
  • 1,156
  • 3
  • 12
  • 29
6
votes
1 answer

QLabel cutting off text on resize

I have a custom widget which has an overall layout of a QVBoxLayout. It contains several labels, a QFormLayout, a button, and a stretch to eat all excess space. One of the labels can be quite large so I am trying to ensure that there are no odd…
ElCraneo
  • 495
  • 1
  • 6
  • 11
5
votes
3 answers

How to programatically resize a QMainWindow to its minimum size

When I have a QMainWindow with a grid layout, when resizing it with the mouse, it won't go below some minimum size that's necessary for all the controls in it to show properly. In my app I sometimes programatically hide controls, but then the window…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
5
votes
1 answer

How can I have a QLabel exactly the size of the QPixmap it is showing?

I need some advice concerning Layouts in QT/PyQt. What I want to achieve is to have an image displayed, centered, scaled correctly, taking the most space it can while keeping its aspect ratio. That can easily be done using this: class…
Plotin
  • 53
  • 1
  • 5
5
votes
1 answer

Making widgets partly overlap in a Qt layout

I am trying to make widgets overlap partly in a Qt layout. My current layout is the following, achieved with a QVBoxLayout containing four QHBoxLayout children: I'm trying to regroup cards of the same suit, in order to achieve something like this…
juef
  • 90
  • 1
  • 7
5
votes
1 answer

PyQt5 - Add image in background of MainWindow layout

New to PyQt5... Here is a very basic question. I would like to add an image inside the layout of a widget. This widget is the Main Window / root widget of my application. I use the following code, but I get an error message. import sys from…
martin_0004
  • 357
  • 1
  • 2
  • 15
5
votes
2 answers

Qt: what layout or combination of layout should use in this case?

I am working on a Qt Project and for this project I require to design something like this: I have designed so far in Qt Creator and I have the component ready, but when I am trying to add widget in different layouts, I am not getting the shapes I…
Shakib Ahmed
  • 781
  • 2
  • 10
  • 24
5
votes
1 answer

ListView isn't positioned in layout as expected

I have a ColumnLayout with a RowLayout in it. The RowLayout is positioned as expected. This is also true if the windows is being resized. Even if the windows is smaller than the entire ColumnLayout (see second image) But if I replace the RowLayout…
avb
  • 1,701
  • 5
  • 22
  • 37
5
votes
1 answer

QScrollArea with dynamically changing contents

I have a QScrollArea with some buttons in it, like shown on the picture. The idea of the layout is: 1. The left and right button should be used for scrolling the buttons when they are too wide 2.The numbers of buttons in the scroll area can be…
GeneralFailure
  • 1,085
  • 3
  • 16
  • 32
4
votes
1 answer

add a layout to another layout from the parent window

I am new to this field, and I Hope this not seems a stupid question I am using PyQt5 for Python 3.8 on mac I want to add a layout(addLayout) to another layout from the parent window if it is possible! This is an example: I have a Class…
Fawaz
  • 83
  • 1
  • 6
4
votes
1 answer

Why are my labels stacking on top of each other inside my QHBoxLayout?

Simply enough, I want to add two labels inside an horizontal box layout using Python's PYQT5. When I execute this code, the two labels appear on top of each other, even though adding them to a QHBoxLayout should position them from left to right. How…
4
votes
2 answers

How does stretch factor work in Qt?

I'm working on a GUI application with pyqt5. At a certain dialog I need many components, being one of those a QWebEngineView as a canvas for plotting data, which should take most of the space available even if the chart is not ready when creating…
Roman Rdgz
  • 12,836
  • 41
  • 131
  • 207
4
votes
1 answer

How to align the layouts QHBoxLayout and QVBoxLayout?

I want to do this layout for my window: So I tried to create a QHBoxLayout layout to put the 3 buttons, and add it to the QVBoxLayout: #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PyQt4 import QtGui class Example(QtGui.QWidget): …
Evandro Coan
  • 8,560
  • 11
  • 83
  • 144
4
votes
1 answer

QScrollArea vertical sizePolicy - Fit contents up to maximum height

I've had a real challenge getting QScrollArea to take the minimum space possible up to a maximum height. My GUI model is as follows: A QScrollArea contains a vertical layout which is populated with a widget of class TableRow. I want this class…
Assimilater
  • 944
  • 14
  • 33
4
votes
1 answer

On Qt how is it possible to set a 3 columns layout with 33% each?

i have a 3 columns layout and i'm struggling to find a solution in order to set 3 fluids columns on 33%.
Ben
  • 87
  • 1
  • 5
1
2
3
15 16