我有一些代码,我需要在C ++中创建2次出现的QMessageBox。 我想对两者使用相同的声明。
如何重新初始化原始声明以避免在第二个QMessageBox上看到额外的“继续”按钮?我不想使用removeButton方法。
逻辑示例:
var ALLOB = {
speed: 3,
recwidth: 5,
recheight: 5,
minvalue: 100,
maxvalue: 900,
lifetime: 10,
xpos: 10,
ypos: 10
};
function rand(min, max) {
"use strict";
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var canvas = document.querySelector("#make");
var ctx = canvas.getContext("2d");
function setCanvasWidth() {
"use strict";
ctx.canvas.width = window.innerWidth;
ctx.canvas.height = window.innerHeight;
}
setCanvasWidth();
function paintover() {
'use strict';
ctx.fillStyle = "rgba(0, 0, 0, 0.12)";
ctx.fillRect(0, 0, canvas.width, canvas.height);
}
function fall() {
'use strict';
ALLOB.ypos = ALLOB.ypos + ALLOB.speed;
if (ALLOB.ypos > canvas.height - ALLOB.lifetime) {
ALLOB.ypos = 10;
}
}
function drawdrop(x, y) {
'use strict';
ctx.fillStyle = "#1cbc61";
ctx.fillRect(ALLOB.xpos + x, ALLOB.ypos + y, ALLOB.recwidth, ALLOB.recheight);
}
function maker() {
"use strict";
drawdrop(400, 10);
}
function animate() {
"use strict";
paintover();
maker();
fall();
}
setInterval(animate, 30);