void mainwindow::setupmenu() { actionbclearall = new QAction(this); actionbclearsel = new QAction(this); actionbclearall->setText("All"); actionbclearsel->setText("Selected"); QMenu *bclearmenu = new QMenu(this); bclearmenu->addAction(actionbclearall); bclearmenu->addAction(actionbclearsel); ui.bclearall->setMenu(bclearmenu); connect(actionbclearall,SIGNAL(triggered()),btable,SLOT(cleartable())); connect(actionbclearsel,SIGNAL(triggered()),btable,SLOT(clearselected())); actionselprintall = new QAction(this); actionselprintsel = new QAction(this); actionselprintall->setText("All"); actionselprintsel->setText("Selected"); QMenu *selprintmenu = new QMenu(this); selprintmenu->addAction(actionselprintall); selprintmenu->addAction(actionselprintsel); ui.bselprint->setMenu(selprintmenu); }
static void atomic (lua_State *L) { global_State *g = G(L); size_t udsize; /* total size of userdata to be finalized */ /* remark occasional upvalues of (maybe) dead threads */ remarkupvals(g); /* traverse objects cautch by write barrier and by 'remarkupvals' */ propagateall(g); /* remark weak tables */ g->gray = g->weak; g->weak = NULL; lua_assert(!iswhite(obj2gco(g->mainthread))); markobject(g, L); /* mark running thread */ markmt(g); /* mark basic metatables (again) */ propagateall(g); /* remark gray again */ g->gray = g->grayagain; g->grayagain = NULL; propagateall(g); udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ marktmu(g); /* mark `preserved' userdata */ udsize += propagateall(g); /* remark, to propagate `preserveness' */ cleartable(g->weak); /* remove collected objects from weak tables */ /* flip current white */ g->currentwhite = cast_byte(otherwhite(g)); g->sweepstrgc = 0; g->sweepgc = &g->rootgc; g->gcstate = GCSsweepstring; g->estimate = g->totalbytes - udsize; /* first estimate */ }
void Classtable::on_pushButton_4_clicked() { cleartable(); QSqlQuery query; QString subname,teacher,tname,classroom,type; int week,time,id; ui->label_2->setText(ui->comboBox->currentText()); query.exec("select name,teacher,week,ttime,id,classroom,type from subject where tname='"+ui->comboBox->currentText()+"'"); while(query.next()) { qDebug() << query.value(0).toString() << query.value(1).toString()<<query.value(2).toInt()<<query.value(3).toInt(); subname=query.value(0).toString(); teacher=query.value(1).toString(); week=query.value(2).toInt(); time=query.value(3).toInt(); tname=ui->comboBox->currentText(); id=query.value(4).toInt(); classroom=query.value(5).toString(); type=query.value(6).toString(); Table newt(id,subname,teacher,week,time,tname); table->append(newt); pos[time][week]=table->count()-1; ui->tableWidget->setItem(time,week,new QTableWidgetItem(subname+"("+classroom+") "+teacher)); // ui->label_2->setText(tname); } }