Questions tagged [qgridlayout]

A QGridLayout is a class from the Qt toolkit which lays out GUI widgets in a grid.

QGridLayout takes the space made available to it by its parent layout or widget, divides it up into rows and columns, and puts each widget it manages into the correct cell.

Each column and row has a minimum width/height and a stretch factor (which determines how much of the available space the column or row will get over and above its necessary minimum). It is also possible for widgets to span multiple rows and/or columns.

The official Qt documentation can be found here.

203 questions
2
votes
5 answers

Removing QWidgets from a QGridLayout

I have a QGridLayout where I add my custom QWidgets. When I try to delete all of them they are supposedly removed from the layout (as the function layout.count() returns 0) but they are still shown in the interface and I can interact with them. Here…
azorrozua
  • 129
  • 1
  • 4
  • 12
1
vote
0 answers

QTextBrowser Resizing on a QGridLayout

I have a QGridLayout which contains all the layout for my class. Until there everything goes fine. I added a QSplitter for other things and then at the bottom (After the splitter) i want the QTextBrowser to be. Fine, works. But i want to resize, i…
Kazuma
  • 1,371
  • 6
  • 19
  • 33
1
vote
1 answer

How to Fix QStatusBar that stops to work if placed it in Layout?

I succeeded to moved the QStatusBar to a specific location (repositioning), but when I hover I don't see the tips anymore. I tried QStatusBar.show() or .setVisible(True) but doesn't still work. How would you approach this. Thanks
1
vote
3 answers

PyQt5 : layout buttons with equal column width

I was using PyQt5 to create a grid layout for my username, password label and input fields and for my submit and cancel button. I added equal row width of 1 for all my widgets, however for my cancel and submit button and I want them to be of the…
Himanshu Poddar
  • 7,112
  • 10
  • 47
  • 93
1
vote
1 answer

GridLayout position in PyQt

I have the following problem, because i want the frame for my "Enter IP-address" to have the same size as the three other frames below it, which is "Open file/Save file", "parameter" and "hyppighed". And i want my "start log" frame to go all the way…
nabs
  • 35
  • 6
1
vote
1 answer

maintain grid layout widget as square

This should be easy but I'm just becoming more and more confused looking at suggested answers that don't work. All I want to do is to be able to have a bunch of widgets in a grid layout where resizing the window will result in the widgets inside the…
Eugene Gill
  • 339
  • 4
  • 15
1
vote
1 answer

QScrollArea in QGridLayout

In PySide6 (the same as PySide2 and PyQt5) I wanted to divide the QMainWindow into four parts, each with a QScrollArea for displaying an image.Here is the minimal reproducible example. from PySide6.QtCore import * from PySide6.QtGui import * from…
JanTang
  • 21
  • 3
1
vote
1 answer

why the QGridLayout do not work for QLabel

I am using QGridLayout in my project, and the code is: import sys from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * class MainWindow(QMainWindow): def __init__(self, parent=None): super(MainWindow,…
Qiang Zhang
  • 820
  • 8
  • 32
1
vote
1 answer

How to deal with tables in QGridLayout acting weird

I'm having trouble fitting 2 tables into QGridLayout. I've read some examples and thought I got the grip of it. Apparently, I didn't. This is how I visualized it: So I supposed this code should work: layout =…
1
vote
1 answer

QGridLayout Widgets Set Equal Size

.h file: QChartView *chrtViewArr[5]; QGridLayout *graphLayout; QFrame *graphFrame; .cpp file: { ... this->graphLayout = new QGridLayout(this->graphFrame); for(int i=0;i<3;i++){ this->graphLayout->addWidget(this->chrtViewArr[i],i,0); …
1
vote
1 answer

Issues with position manipulation using QGridLayout addWidget(QWidget,x,y)

This is a really simple question I'm just new to PyQt5 and am a bit confused on how QGridLayout works... def init_main_page(self): layout = QGridLayout() b1 = buttons.QPushButton("0",self.main_page) b2 =…
Henrique Lee
  • 59
  • 1
  • 1
  • 7
1
vote
1 answer

QGridlLayout with non-stretchable-height rows

I'm trying to build a QGridLayout with stretchable-width columns but non-stretchable-height rows. The grid in inside a QScrollArea, and with the exception of the height, it's almost working. You can see it in the following images: As you can see,…
dvilela
  • 1,200
  • 12
  • 29
1
vote
1 answer

PyQt5 QMainWindow not displaying central widget

I want to have a central Widget with a grid layout containing multiple other widgets . the problem is that the central widget is not showing on QMainWindow even after using setCentralWidget function . here is the code that is not working, i can't…
nzz coding
  • 47
  • 7
1
vote
0 answers

Interact with a Qlabel an mouseclick

I am currently reproducing the Diaballik game on qwidget with qtcreator. I decided to make a login page as well as a game page. The problem I have is that I need a qgridlayout in which I add buttons or labels with which I have to interact via the…
1
vote
0 answers

PyQt5 removing QListWidgets and QPushButton dynamically and interact with listItems

Within my QApplication I want to create QListWidgets dynamically and do something with listitems. I want to create a Favorite Tab. The only think that work is self.listWidget_fav.clear There are 4 QPushButtons the self.buttonOK button have to use…
sticki
  • 43
  • 1
  • 8