Pilot Pilot - 2 months ago 13x
C++ Question

Qt serial communication terminal

I'm trying to modify

terminal example. I'm new to
and I have a problem with
Now the console is stretched to whole window. There is only a main toolbar, a status bar, a menu and I would like to add some buttons etc.

I know that I should use layers before setting central widget but I don't know how. I would like to put this console into small text area just to get info from serial. For sending commands buttons will be available.

Can some one help me with changing this code ?


I have found solution for my problem. It is very simple. First we have to create new layout for example gridlayout, then addWidget to layout and set central widget from Qwidget as below:

QGridLayout *layout = new QGridLayout;

layout->addWidget(ui->tabWidget, 0, 0, 1, 2);
layout->addWidget(ui->info, 1, 0, 1, 2);
layout->addWidget(console, 2, 0, 1, 2);

QWidget *window = new QWidget();