有没有方法可以在同一个页面放置225个按钮?
我写的代码,运行后十几秒就会关闭,然后显示“程序异常结束”
代码如下:
int piece_place[16]={0,13,33,54,76,97,119,140,161,182,204,225,247,268,290,313}; //横纵坐标
QPushButton *btn=new QPushButton(this);
for(int i=1;i<=15;i++)
for(int j=1;j<=15;j++)
{
btn=new QPushButton(this);
btn->setStyleSheet(QString("QPushButton{background-color:rgba(0,0,0,0);border-width:0px;border-radius:7;} QPushButton:hover{background-color:rgba(255,255,255,0.5);border-width:0px;}"));
btn->setGeometry(piece_place[i],piece_place[j],14,14);
btn->show();
}
你好,我是问答小助手,本次您提出的有问必答问题,技术专家团超时未为您做出解答
本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。
因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。