【问题标题】:QtCreator stopped working when a widget added添加小部件时 QtCreator 停止工作
【发布时间】:2020-06-29 08:49:43
【问题描述】:

我的框架上有 2 个按钮,但是当我尝试添加第三个按钮时,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 中时停止工作。任何帮助将不胜感激。谢谢!

【问题讨论】:

    标签: qt-creator qpushbutton qframe


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-16
      • 1970-01-01
      • 1970-01-01
      • 2019-01-18
      • 2012-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多