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
0
votes
1 answer

setSpacing does not work for QHBoxLayout?

I need to create an element like ComboBox which is combination of LineEdit and a Button. QHBoxLayout *lineEditWithButtonForm = new QHBoxLayout( this ); lineEditWithButtonForm->setSpacing( 0 ); lineEditWithButtonForm->setContentsMargins( 0, 0, 0, 0…
gnase
  • 580
  • 2
  • 10
  • 25
0
votes
1 answer

pyqt5 managing layout with labels

Im trying to add couple of labels to my layout and those items needs to be adjacent. The below code keeps them adjacent but its in the middle of the layout. I want those labels to be in the top. import sys from PyQt5.QtWidgets import QWidget,…
user1050619
  • 19,822
  • 85
  • 237
  • 413
0
votes
2 answers

Dynamically add and remove a Layout when one of the Radio Button is Selected

I m able to dynamically add a layout to QHBoxLayout in pyqt , however I m unable to remove them once added. Main aim is to dynamically add and remove a layout based on the Radio Button selected. def SearchTab(self): self.layout = QVBoxLayout() …
Vaebhav
  • 4,672
  • 1
  • 13
  • 33
0
votes
1 answer

How to move comboBox to the bottom of its it's vertical layout?

In my program when a push button is pressed, I need the comboBox at the top of the verticalLayout to move down to the bottom so the 2nd comboBox is at the top. The comboBoxes have been created in Qt designer and I need this to be able to be done…
Abhi Garg
  • 73
  • 7
0
votes
1 answer

Layout management in Qt

I have a small program which contains a QGroupBox with other widgets like this: I tried many ways to manage the size of the QGroupBox to make the height as the same as the rest of the parts. Except for the way of using setMaximumHeight, because I…
Theodore Tang
  • 831
  • 2
  • 21
  • 42
0
votes
1 answer

Custom widgets in scroll area not respecting minimum?

I'm getting closer to getting a QScrollArea working, but it's still shrinking my custom widgets as they are added. Everything is resizing fluidly, and if the scroll area is too small, then the scroll bar appears, so it clearly has some idea of a…
gbryant
  • 751
  • 5
  • 19
0
votes
1 answer

Pyqt5 addStretch in between widgets?

I am using a QVBox layout and there are two widgets and a dynamic layout 'layout2' in the layout. Widget1 is fixed on top Widget3 is fixed at the bottom and widget2 is dynamic widget. layout2 is deleted and added each time. The problem here is I am…
S_Ymln
  • 421
  • 3
  • 14
0
votes
1 answer

Qt's dialog box button size bug

In a QDialogButtonBox class object, its button sizes are reduced: While in other dialogs, the buttons look normal: Both dialogs were made through Qt's Designer Mode, with no additional code on my part concerning these QDialogButtonBox class…
0
votes
1 answer

How to make QTextBrowser to have biggest size?

I have QScrollArea which has QVBoxLayout where I place widgets and one of them is QTextBrowser and I want to make QTextBrowser to have size of its content and to remove its scrollbars. I inherited QTextBrowser, changed sizePolicy, hid scrollbars…
devalone
  • 535
  • 6
  • 21
0
votes
1 answer

Qt: How to make custom widget that aligns like QTextField

I am trying to make a DirectoryEditWidget, i.e. a widget similar to a QLineEdit widget, but with a browse-button to allow the user to browse the file system for the directory. The functionality is working in the implementation below, but I would…
Janus
  • 5,421
  • 2
  • 26
  • 37
0
votes
3 answers

How to create a QFrame in the middle of another QFrame?

Can I use the Qt to do the things below: I need two QFrames, one (child) is in the middle of another (parent), and when I change the parent QFrame, the children will resize too. How can I set the layout or other thing can do like that. Just like the…
XU WEI
  • 11
  • 2
0
votes
0 answers

when is the size of a QWidget in a QGridLayout specified?

in my Qt-application I add a QGridLayout to the main window. Afterwards, i include some QLabels, some with QSizePolicy::Minimum, others with QSizePolicy::Expanding. I add the labels into the grid in the resizeEvent of the window. At the end of the…
big_Stone
  • 11
  • 5
0
votes
2 answers

Qt Layouts in QCreator

I'm having a lot of trouble trying to figure out how QLayouts work. Basically, I start a MainWindow project, then add a new QWidget-based form where I lay out QLineEdits and QLabels in a horizontal layout for use as a dotted-quad input editor. All…
SixDegrees
  • 781
  • 1
  • 8
  • 19
0
votes
2 answers

QVBoxLayout add all widgets

I'm trying to add a number of QLabels into a QVBoxLayout: QVBoxLayout *qVB = new QVBoxLayout(); QLabel *l1 = new QLabel("L 1"); QLabel *l2 = new QLabel("L 2"); QLabel *l3 = new QLabel("L 3"); QLabel *l4 = new QLabel("L 4"); qVB ->…
Program-Me-Rev
  • 6,184
  • 18
  • 58
  • 142
0
votes
2 answers

ui file Layout setting not working in PyQt

I have a very minimalistic QWidget setup, consisting of two classes. MainWindow and MainWidget. Both are loaded as .ui files, which results in a working GUI in Qt (run with QtCreator), but when I try to run it with PyQt the layout of the MainWidget…
yspreen
  • 1,759
  • 2
  • 20
  • 44