QLayoutItem属性的问题

时间:2017-05-13 10:53:19

标签: c++ qt

我是Qt的新手,我想创建自己的布局作为我的第一个项目,但我在定位调整大小方面遇到了一些问题。我的布局中的项目,更准确地说是setGeometry。这就是我的方法:

void Panel::setGeometry(const QRect &rect)
{
   QLayout::setGeometry(rect);

   QLayoutItem* item = itemList.at(0); // Get the item at index 0

   item->setGeometry(QRect(10,10,200,100)); // Here's the problem

}

我的项目表现奇怪,唯一正确的属性是(宽度 x ),所以我的问题是,是什么原因造成的?如果你愿意,我可以提供更多细节,欢迎任何批评(好的或坏的),谢谢!

0 个答案:

没有答案