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
3
votes
3 answers

qt set widgets in qgridlayout with same size

I have following layouts: when I stretch the window, the size becomes like this: Is there a way to set the widgets in qgridlayout with the same size when the qgridlayout size changes ? Thanks. UPDATE The widget in qgridlayout: #ifndef…
Johnnylin
  • 507
  • 2
  • 7
  • 26
3
votes
1 answer

How to put a rectangle in a particular row and column in GridLayout of QML?

import QtQuick 2.4 import QtQuick.Window 2.2 import QtQuick.Layouts 1.1 // GridLayout Window { visible: true height: 700; width: 1000 GridLayout { id: gridLayout rows: 15; columns: 15; rowSpacing:…
Aquarius_Girl
  • 21,790
  • 65
  • 230
  • 411
3
votes
1 answer

QWidget::layout() can't return QGridLayout?

I have a QWidget that contains a QGridLayout, which in turn contains a handful of QPushButtons. These are all generated programmatically. Later in the code (separate from where the layout is defined), I need to be able to add more pushbuttons to…
Churchbus
  • 53
  • 5
3
votes
1 answer

Qt: Why children widgets overlapping in QGridLayout?

I have an widget x with fixed size. Then at first I took a QScrollArea and then a QGridLayout which I set as the layout of scrollAreaWidgetContent. Then I started adding some widget x in the layout at (0,0), (0,1), (1,0), (1,1)... of grid layout.…
Shakib Ahmed
  • 781
  • 2
  • 10
  • 24
3
votes
1 answer

Setting up a 3x3 QGridLayout with central cell

I'm developing a little game in C++ Qt 4.6.3 and I stumbled upon a layout-issue. The layout I'm looking for is a 3x3 QGridLayout of which the central cell (1,1) holds the main widget (it's a board game). The (0,1)-cell should hold a QLabel…
JorenHeit
  • 3,877
  • 2
  • 22
  • 28
2
votes
1 answer

How to add stretch for QGridLayout in PyQt5?

I created widgets in a grid-layout. The widgets are stretching based on the window. Is it possible to avoid the stretching and align them as shown in picture below? I created a code to achieve this, but I feel it is not a straightforward solution.…
Viswa
  • 134
  • 1
  • 13
2
votes
1 answer

How to reduce the space between Two Widgets in PyQt5 QGridLayout?

How to arrange Widgets in QGridLayout as desired? For example, In My code, I need to reduce the space between the " Country" and "State" Button Place the Widgets in top left most Corner ( Country Button in Top left Most Corner- No Margins) reduce…
Kumar
  • 592
  • 6
  • 18
2
votes
1 answer

How can I change the size of a QGridLayout's widgets?

Take the following code: from PyQt5 import QtGui, QtWidgets, QtCore from PyQt5.QtWidgets import QApplication, QMainWindow import sys class MainWindow(QMainWindow): def __init__(self): super(MainWindow, self).__init__() win_w,…
Have a nice day
  • 1,007
  • 5
  • 11
2
votes
1 answer

GridLayout Arrangement

Following is my main.qml: Window { id: window visible: true width: 800 height: 480 title: qsTr("Hello World") ListModel { id: _listModel ListElement { textData: "E1" isEnabled: false …
BikashRDas
  • 149
  • 1
  • 10
2
votes
1 answer

Pyqt5 QGridlayout issue when using QTextEdit

I want to adjust height and width using grid layout. class MatchStepWidget(QWidget): def __init__(self,parent): super(MatchStepWidget,self).__init__(parent) self.initUI() def initUI(self): layout =…
dauren slambekov
  • 378
  • 3
  • 15
2
votes
1 answer

QGridLayout doesn't update when contents is resized?

I am trying to use a QGridLayout to hold resizable widgets, but when I resize them it doesn't work, the QGridLayout cells stay the same size... Here is a minimal working example of the scenario causing me confusion. Double clicking the red squares…
pyjamas
  • 4,608
  • 5
  • 38
  • 70
2
votes
1 answer

How to reserve space for hidden QtWaitingSpinner in QGridLayout?

I'm trying to build a QtGui application that uses the QtWaitingSpinner found here: https://github.com/z3ntu/QtWaitingSpinner. I have it in a QGridLayout. However, this means that the button next to it changes size when the spinner is unhidden and…
Jacob
  • 103
  • 2
  • 7
2
votes
1 answer

How can I get rid of the previous layout and set new Grid Layout in QMainWindow?

I am a newbie with PyQt. I am trying to organize my buttons on a grid layout, but I guess the window has a default layout already. How can I get rid of it and replace it with the new Grid Layout? I have contained the code block relevant with hashes…
Elham Khan
  • 71
  • 8
2
votes
1 answer

Widget overlap eachother in GridLayout

I am trying to create a simple Program using GridLayout, all the widgets inside the QWidget window do show up and scale properly however the LineEdit overlaps the Title Label of the window. from PySide2 import QtWidgets, QtCore, QtGui import…
Sahil
  • 1,387
  • 14
  • 41
2
votes
1 answer

How to create a grid of splitters

What I'm trying to do is add splitter to a QGridLayout in order to resize the layout with the mouse. So for instance with this : from PyQt5.QtGui import * from PyQt5.QtCore import * from PyQt5.QtWidgets import * import sys class…
ymmx
  • 4,769
  • 5
  • 32
  • 64
1 2
3
13 14