PDA

View Full Version : add vertical spacer in QGridLayout



dan1973
9th January 2021, 08:07
How to Add Vertical spacer in QGridLayout?.

In my code (part) here:



glMain->addWidget(lblHdg, 0, 0);
glMain->setAlignment(lblHdg, Qt::AlignTop | Qt::AlignCenter);
glMain->addLayout(hbxCh1, 1, 0);
glMain->setAlignment(hbxCh1, Qt::AlignTop | Qt::AlignLeft);
glMain->addLayout(hbxCh2, 2, 0);
glMain->setAlignment(hbxCh2, Qt::AlignTop | Qt::AlignLeft);
QSpacerItem *spcr;
glMain->addItem(spcr, 3, 0, 4, 1);



it is giving error while i run. it is compiling, but gives "The program has unexpectedly finished." red error.

ChristianEhrlicher
9th January 2021, 13:15
> QSpacerItem *spcr;

Maybe you should initialize the pointer?