void MainWindow::refreshScore() { if(enemyKilled) { enemyKilled = false; int num = player->score; clearScore(); do { int index = num%10; num /= 10; QPixmap temp(this->numbers[index]); QLabel* templbl = new QLabel(); templbl->setPixmap(temp); templbl->setFixedSize(15,15); templbl->setScaledContents(true); templbl->setParent(this); scoreNumbers->append(templbl); }while(num != 0); int start = 30 + (30* scoreNumbers->size()); for(int i = 0; i < scoreNumbers->size(); i++) { scoreNumbers->at(i)->move(start, 30); scoreNumbers->at(i)->show(); start -=30; } } }
void Window :: createMenu() { saveAction = fileMenu->addAction(tr("&Save Score")); clearAction = fileMenu->addAction(tr("&Clear Score")); openAction = fileMenu->addAction(tr("&Open Score")); fileMenu->addSeparator(); exitAction = fileMenu->addAction(tr("E&xit")); menuBar->addMenu(fileMenu); connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); connect(clearAction, SIGNAL(triggered()), this, SLOT(clearScore())); connect(openAction, SIGNAL(triggered()), this, SLOT(openScores())); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); helpMenu = new QMenu(tr("&About"), this); helpMenu->addAction(aboutAct); menuBar->addMenu(helpMenu); }