开发者

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

开发者 https://www.devze.com 2022-12-18 07:32 出处:网络
Could anyone tell me why I\'m getting error and how to fix it? QGridLayout* mainLayout = new QGridLayout;

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

        QGridLayout* mainLayout = new QGridLayout;
        QGridLayout *leftLayout = new QGridLayout;
        QGri开发者_JAVA技巧dLayout *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.


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消