tags:

views:

32

answers:

1

Hi, 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.

+1  A: 

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);
Polybos
And whay it gives me an error saying that I'm providing ref to pointer as an argument?
There is nothing we can do
Probably because your compiler is first trying to pass the argument by reference. But if you pass the correct parameters as I showed you, you'll don't see error anymore (I expect).
Polybos