Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding layout to another layout in Qt [C++]

Tags:

c++

Could anyone tell me why I'm getting error and how to fix it?

        QGridLayout* mainLayout = new QGridLayout;
        QGridLayout *leftLayout = new QGridLayout;
        QGridLayout *rightLayout = new QGridLayout;
        mainLayout->addLayout(leftLayout);
        mainLayout->addLayout(rightLayout);
        setLayout(mainLayout);

error I'm getting: 'error: no matching function for call to 'QGridLayout::addLayout(QGridLayout*&)'
Thank you for any help.

like image 744
There is nothing we can do Avatar asked Jan 29 '10 20:01

There is nothing we can do


1 Answers

Qt4 Reference says:

void addLayout ( QLayout * layout, int row, int column, Qt::Alignment alignment = 0 )

So you have to do:

mainLayout->addLayout(leftLayout, 0, 0);
mainLayout->addLayout(rightLayout, 0, 1);
like image 198
Karl von Moor Avatar answered Oct 01 '22 09:10

Karl von Moor