P
P
Pavel Matveev2020-06-14 08:45:11
Qt
Pavel Matveev, 2020-06-14 08:45:11

How to add widgets to Layout at runtime (dynamically)?

It's not clear how to add widgets to QGridLayout/QVBoxLayout/QHBoxLayout at runtime. Through the method I tried addWidget (), but, no matter how I did it, it crashes. I was looking for examples of dynamically adding widgets, but I didn’t find anything intelligible / relevant ... I didn’t find it in the documentation either - maybe I didn’t look well. Masters, please tell me how to add widgets to Layout at runtime? I would like with examples, but you can just link to the necessary documentation ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jacob E, 2020-06-14
@axe_lankaster13

The very first link in Google: https://evileg.com/ru/post/77/
And read any book on Qt, save a lot of time on such elementary questions.

A
Alexander Ananiev, 2020-06-14
@SaNNy32

layout()->addWidget(myWidget)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question