QT为什么一改坐标就好使了呢

sinat_19306371 2018-08-11 10:55:55
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QString str1[3] = {"Game", "Office", "Develop"};
QString str2[3] = {"P&rogramming", "Q&t", "O&S"};

int xpos = 30;
int ypos = 30;

chk_group[0] = new QButtonGroup(this);
chk_group[1] = new QButtonGroup(this);

for(int i = 0 ; i < 3 ; i++)
{
exclusive[i] = new QCheckBox(str1[i], this);
exclusive[i]->setGeometry(xpos, ypos, 100, 30);
chk_group[0]->addButton(exclusive[i]);

non_exclusive[i] = new QCheckBox(str2[i], this);
non_exclusive[i]->setGeometry(xpos + 120, ypos, 100, 30);
chk_group[1]->addButton(non_exclusive[i]);



ypos += 40;
}

chk_group[0]->setExclusive(false);
chk_group[1]->setExclusive(true);


}


第一组 复选 第二组 可以单选
为什么把这个 non_exclusive[i]->setGeometry(xpos + 120, ypos, 100, 30); 改个值
non_exclusive[i]->setGeometry(xpos + 120, ypos, 100, 100); 就能用了呢
...全文
279 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
sinat_19306371 2018-08-11
  • 打赏
  • 举报
回复
只是改下参数 坐标 就不可以用了
sinat_19306371 2018-08-11
  • 打赏
  • 举报
回复
non_exclusive[i]->setGeometry(xpos + 120, ypos, 100, 100); 就能不用了呢

我怀疑这个setGeometry
tony2278 2018-08-11
  • 打赏
  • 举报
回复
不能用的case是什么?

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧