Skip to main content

All Questions

Tagged with
276 votes
5 answers
268k views

Auto-expanding layout with Qt-Designer

I'm using the Qt Designer. I want to create a QVBoxLayout which will automatically expand to fill the whole window. The layout of the QVBoxLayout remains fixed. How can I cause the QVBoxLayout to ...
Elazar Leibovich's user avatar
58 votes
10 answers
58k views

How to make a Qt widget invisible without changing the position of the other Qt widgets?

I've got a window full of QPushButtons and QLabels and various other fun QWidgets, all layed out dynamically using various QLayout objects... and what I'd like to do is occasionally make some of those ...
Jeremy Friesner's user avatar
41 votes
4 answers
94k views

Qt Layout on QMainWindow

I designed a QMainWindow with QtCreator's designer. It consists of the default central widget (a QWidget) which contains a QVBoxLayout with all the other widgets in it. Now everything I want, is that ...
Milan's user avatar
  • 3,362
4 votes
3 answers
7k views

How to remove Qt widget (with layout) space

I have written a program that uses widgets as container (for other widgets). Because the contents of the container varies along the program life, the container widget has a layout associated to it so ...
user1159290's user avatar
4 votes
3 answers
4k views

Resize QMainWindow to minimal size after content of layout changes

I'm using a subclass of QMainWindow, in which I declared a central widget. This widget contains, among other things, a QGridLayout, which holds a set of buttons. The amount of buttons can grow or ...
Steffen's user avatar
  • 4,239
23 votes
2 answers
75k views

About deleting, removing widgets and layouts in Qt 4

(I use Qt 4.7, Windows 7, 64bit). I created a custom table. Each row is a horizontal layout with widgets. The rows are kept in a QList for easy access, and the children too. The rows are also added ...
Darkgaze's user avatar
  • 2,543
20 votes
2 answers
39k views

Setting text on a QLabel in a layout, doesn't resize

Using the designer in Qt creator I have created a dialog that contains various widgets in a vertical layout. One of the widgets is a QLabel with word wrap set to true. The text for the QLabel is set ...
TheDarkKnight's user avatar
18 votes
2 answers
22k views

QWidget::setLayout: Attempting to set QLayout "" on Widget "", which already has a layout

I'm trying to set the layout of a widget manually through code (not in Designer), but I'm doing something wrong, because I get this warning: QWidget::setLayout: Attempting to set QLayout "" on ...
user1369511's user avatar
8 votes
1 answer
6k views

Fix tab order after inserting widgets in a layout in QT

I have a custom list implementation (a subclass of QWidget) in QT 5.5. The elements of the list are organized using a QVBoxLayout. At runtime, elements (which are also QWidgets) can be dynamically ...
Cybran's user avatar
  • 2,303
48 votes
10 answers
31k views

Hiding Qt widget and keeping widget space

In a simple form I made a few buttons and put a horizontal layout. When mouse leaves the area one of the buttons, the last one, should be hidden. Using button->hide() it works, but all the buttons ...
humberto's user avatar
  • 481
13 votes
3 answers
18k views

How to align children in a QHBoxLayout Left, Center and Right

I have a QHBoxlayout with children set up as follows: QHBoxlayout h = new QHBoxlayout(); QLLabel leftLabel = new QLLabel("Left"); QLLabel centerLabel = new QLLabel("Center"); QHBoxlayout ...
Program-Me-Rev's user avatar
12 votes
3 answers
13k views

How do I overlay widgets?

I want to create some widgets and place them out-of-layout, but rather tweak their size and position when some other widget's geometry is changed. Something like the buttons on the screenshot:
Andrew T's user avatar
  • 5,735
9 votes
3 answers
9k views

Use the same widget in two different layouts in Qt

I would like to use the same widget in two different layouts in Qt. Here is my code: QWidget *myWidget = new QWidget; QFormLayout *layout1 = new QFormLayout; layout1->addWidget(myWidget); ...
Donald Duck's user avatar
  • 8,821
8 votes
1 answer
3k views

Custom Layout in Qt Designer

Is there anyway that we can have Custom Layouts e.g. as defined at https://doc.qt.io/archives/qt-4.7/examples-layouts.html inside the Qt Designer ? What would be the process to add such custom ...
Orochi's user avatar
  • 397
4 votes
1 answer
11k views

Qt layouts - Keep widget aspect ratio while resizing [duplicate]

I want to keep an aspect ratio of 16/9 on a QGroupBox (the one on the left on the screenshot below). For the tests I made a simple program with 4 groupboxes in a vertical layout, all in an horizontal ...
GuiTeK's user avatar
  • 1,731

15 30 50 per page