void StudentDashBoard::createActions() { //reset system toolbar connect(timer,SIGNAL(timeout()),this,SLOT(statusMessage())); connect(messageCheck,SIGNAL(timeout()),this,SLOT(newQuestion())); connect(broadCastTimer,SIGNAL(timeout()),SLOT(showBroadCastContent())); connect(clearHelpContent,SIGNAL(timeout()),ui->label,SLOT(clear())); connect(clearHelpContent,SIGNAL(timeout()),clearHelpContent,SLOT(stop())); connect(clearBroadCastContent,SIGNAL(timeout()),SLOT(clearBroadCast())); connect(clearBroadCastContent,SIGNAL(timeout()),clearBroadCastContent,SLOT(stop())); //the head actions connect(ui->exit,SIGNAL(clicked()),this,SLOT(quitApp())); connect(ui->helpBtn,SIGNAL(clicked()),this,SLOT(showHelpInfo())); //viewppt connect(ui->viewpptBtn,SIGNAL(clicked()),this,SLOT(viewPPt())); //coding connect(ui->codingBtn,SIGNAL(clicked()),timer,SLOT(stop())); connect(ui->codingBtn,SIGNAL(clicked()),codingWin,SLOT(showFullScreen())); connect(codingWin,SIGNAL(exitCoding()),SLOT(showFullScreen())); connect(codingWin,SIGNAL(serverStarted()),SLOT(hide()));///???????????????????????????????!!!!!!!!!!!!!!!!! //question connect(ui->questionViewBtn,SIGNAL(clicked()),this,SLOT(exerciseQuestion())); //socket to server connect(socket, SIGNAL( readyRead()), SLOT(receiveQuestionID())); // connect(qApp,SIGNAL(aboutToQuit()),SLOT(sendStudentStatus())); //video view connect(ui->viewVideoBtn,SIGNAL(clicked()),this,SLOT(viewVideos())); //refreshdata connect(this,SIGNAL(refreshDatabase()),SLOT(refreshDataFromDB())); }
Robot::Robot(QWidget* w) : QWidget(w) , panel(this) , send("Send") , clear("Clear") , screenshot("Screenshot") { setWindowTitle(QStringLiteral("图灵机器人")); network = Network::instance(); Answer *answer = new Answer(QStringLiteral("你好,我是机器人图灵,有什么可以帮您"),&*panel); panel->addDialog(answer); setButton(); setLine(); setPanel(); QGridLayout* lay = new QGridLayout(this); lay->addWidget(&panel, 0, 0, 1, 3); lay->addWidget(&line, 1, 0, 1, 3); lay->addWidget(&screenshot, 2, 0); lay->addWidget(&clear, 2, 1); lay->addWidget(&send, 2, 2); setStyleSheet("background-color:rgb(61, 61, 61);"); my::moveToScrCenter(this); connect(&send, SIGNAL(clicked()), this, SLOT(newQuestion())); connect(&clear, SIGNAL(clicked()), this, SLOT(clearAllContents())); connect(&screenshot, SIGNAL(clicked()), this, SLOT(saveScreenshot())); connect(network, SIGNAL(finished(QNetworkReply*)), this, SLOT(handleDownload(QNetworkReply*))); }
//构造函数 CenterWidget::CenterWidget(int questions):questionMax(questions) { layout=new QGridLayout(this); questionNum=1;//题号初始化为1 qnum=new QLabel(QString("Question %1").arg(questionNum),this); layout->addWidget(qnum,0,0,1,1,Qt::AlignLeft); //随机生成新的矩阵题 newQuestion(); layout->addWidget(matrices,1,0); //加入计时显示 QHBoxLayout *buttom=new QHBoxLayout(); showtime=new QLCDNumber(this); showtime->setSegmentStyle(QLCDNumber::Filled); buttom->addWidget(showtime); //加入下一题按钮Next buttom->addSpacing(150); buttonNext=new QPushButton(QIcon("../images/next.png"),"Next",this); buttonNext->setMinimumSize(80,40); buttom->addWidget(buttonNext); connect(buttonNext,SIGNAL(clicked()),this,SLOT(nextMatrix())); layout->addLayout(buttom,2,0); //计时设置 timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(update())); time.start(); timer->start(1000); update(); }
task main() { newQuestion(q1,0,"Question",getQuestionAnswer("test",2,LEFT,3),getQuestionAnswer("test",2,CENTER,3),getQuestionAnswer("test",2,RIGHT,3)); //startTask(lcdWizard); Answer test; //test = (Answer) getQuestionAnswer("test",2,CENTER,3); writeDebugStreamLine("%s",test.button); while(1){} }
void Robot::setLine() { QFont f(QStringLiteral("微软雅黑")); f.setPixelSize(12); line.setFont(f); line.setMinimumHeight(40); line.setStyleSheet("border:5px groove rgb(255,127,39);" "padding:0px ;" "background-color:white;"); line.setFocus(); connect(&line, SIGNAL(returnPressed()), this, SLOT(newQuestion())); }
void MainView::checkAnswer() { if ( mQuestions.count() == 0 ) { kdError() << "checkAnswer(): no questions." << endl; return; } mReadyTimer.stop(); Question q = *mCurrentQuestion; QString text = "<qt>"; if ( mAnswerEdit->text() == q.answer() ) { text += i18n("Correct answer:"); mResultView->incrementCurrentCount(); mQuestions.remove( mCurrentQuestion ); } else { text += "<font color=\"red\">" + i18n("Wrong answer.") + "</font><br>"; text += i18n("Correct Answer:"); mResultView->incrementWrongCount(); } text += "<br>"; text += q.question() + " = " + q.answer(); text += "</qt>"; mFeedbackText->setText( text ); if ( mQuestions.count() == 0 ) { QString text = "<qt>"; text += i18n("<b>Congratulation!</b><br/>"); text += i18n("You answered all questions.<br/>"); text += "<br/>"; if ( mResultView->wrongCount() == 0 ) { text += i18n("You gave no wrong answers."); } else { text += i18n("You gave one wrong answer.", "You gave %n wrong answers", mResultView->wrongCount() ); } text += "<br/>"; text += mResultView->rating(); text += "</qt>"; KMessageBox::information( this, text ); mQuestionLabel->setText( "" ); mAnswerEdit->setText( "" ); mAnswerEdit->setEnabled( false ); mOkButton->setEnabled( false ); mFeedbackText->setText( i18n("You won.") ); } else { newQuestion(); } }
//生成下一个矩阵题 void CenterWidget::nextMatrix() { userAnswers.push_back(matrices->getUserAnswer()); questionNum++;//题号加1 if(questionNum>questionMax){//已达到测试题数 getResult(); return; } //消去窗口中的当前矩阵题 layout->removeWidget(matrices); layout->removeWidget(qnum); delete matrices; delete qnum; //在窗口中加入下一个矩阵题 newQuestion(); qnum=new QLabel(QString("Question %1").arg(questionNum),this); layout->addWidget(qnum,0,0); layout->addWidget(matrices,1,0); }