QtCreator在添加小部件时停止工作



我的框架上有 2 个按钮,但当我尝试添加第 3 个按钮时,QtCreator 停止工作。当我尝试添加另一个框架时,同样的事情发生了。这是我的代码示例。

QFrame *buttonFrame = new QFrame(this);
buttonFrame->setGeometry(930,900,750,100);
buttonFrame->setFrameShape(QFrame::StyledPanel);
QPushButton *nextbutton = new QPushButton(buttonFrame);
nextbutton->setText("Sonraki  ");
nextbutton->setLayoutDirection(Qt::RightToLeft);
nextbutton->setMinimumSize(25,30);
QPushButton *downloadButton = new QPushButton(buttonFrame);
downloadButton->setText("  İndir");
downloadButton->setMinimumSize(25,30);
QPushButton *totalButton = new QPushButton(buttonFrame);
totalButton->setText("Tüm veriyi göster");
totalButton->setMinimumSize(25,40);
buttonLayout->addWidget(downloadButton,0,1);
buttonLayout->addWidget(nextbutton,0,2);
buttonLayout->addWidget(totalButton,0,3);

当 totalButton 推荐出来时,这段代码可以完美运行,但是当我尝试将其添加到 buttonFrame QtCreator 中时,它停止工作。任何帮助将不胜感激。谢谢!

我的主窗口正在初始化我之前给出的固定大小。当我删除固定大小功能并初始化主窗口默认大小时,问题解决了。我希望它能帮助任何有同样问题的人。

最新更新